From f0e9a50919f80ea8413866269056e86098428248 Mon Sep 17 00:00:00 2001 From: chenghongxing <1126263215@qq.com> Date: Wed, 16 Sep 2020 23:04:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20problem=20that=20it's=20not=20effective?= =?UTF-8?q?=20of=20authority=20in=20button;=20=E2=AD=90=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=EF=BC=9A=E6=8C=89=E9=92=AE=E4=B8=AD=E7=9A=84=E6=9D=83?= =?UTF-8?q?=E9=99=90=E4=B8=8D=E8=B5=B7=E4=BD=9C=E7=94=A8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/authority-plugin.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/authority-plugin.js b/src/plugins/authority-plugin.js index f8e756f..429a545 100644 --- a/src/plugins/authority-plugin.js +++ b/src/plugins/authority-plugin.js @@ -88,7 +88,7 @@ const checkInject = function (el, binding,vnode) { const addDisabled = function (el) { if (el.tagName === 'BUTTON') { - el.setAttribute('disabled', 'disabled') + el.disabled = true } else { el.classList.add('disabled') } @@ -96,8 +96,8 @@ const addDisabled = function (el) { } const removeDisabled = function (el) { + el.disabled = false el.classList.remove('disabled') - el.removeAttribute('disabled') el.removeAttribute('title') } @@ -105,10 +105,10 @@ const AuthorityPlugin = { install(Vue) { Vue.directive('auth', { bind(el, binding,vnode) { - checkInject(el, binding, vnode) + setTimeout(() => checkInject(el, binding, vnode), 10) }, - update(el, binding,vnode) { - checkInject(el, binding, vnode) + componentUpdated(el, binding,vnode) { + setTimeout(() => checkInject(el, binding, vnode), 10) }, unbind(el) { removeDisabled(el)