fix: the problem that v-auth directive doesn't take effect in native html element; 🐛

修复:v-auth 指令在原生 HTML 元素上不生效的 bug;
This commit is contained in:
iczer 2020-08-04 19:45:10 +08:00
parent c05efdee7a
commit 3e665bb7a9
2 changed files with 3 additions and 2 deletions

View File

@ -48,6 +48,7 @@ const auth = function(authConfig, permission, role, permissions, roles) {
* @returns {boolean}
*/
const preventClick = function (event) {
event.preventDefault()
event.stopPropagation()
return false
}
@ -55,7 +56,7 @@ const preventClick = function (event) {
const checkInject = function (el, binding,vnode) {
const type = binding.arg
const check = binding.value
const instance = vnode.componentInstance
const instance = vnode.context
const $auth = instance.$auth
if (!$auth || !$auth(check, type)) {
el.classList.add('disabled')

View File

@ -28,5 +28,5 @@
}
.disabled{
cursor: not-allowed;
opacity: 0.4;
color: @disabled-color;
}