|
@@ -18,7 +18,7 @@ export function authDirective(app: App) {
|
|
|
if (buttons.includes(allPermissions)) return
|
|
|
|
|
|
// 不显示该dom
|
|
|
- if (!buttons.includes(binding.value)) el.parentNode.removeChild(el)
|
|
|
+ if (!buttons.includes(binding.value)) el.parentNode?.removeChild(el)
|
|
|
// 设置为disabled
|
|
|
// if (!buttons.includes(binding.value)) el.classList.add('v-disabled')
|
|
|
},
|
|
@@ -26,7 +26,7 @@ export function authDirective(app: App) {
|
|
|
app.directive('noauth', {
|
|
|
mounted(el, binding) {
|
|
|
const buttons = <string[]>router.currentRoute.value.meta.buttons
|
|
|
- if (buttons.includes(binding.value)) el.parentNode.removeChild(el)
|
|
|
+ if (buttons.includes(binding.value)) el.parentNode?.removeChild(el)
|
|
|
},
|
|
|
});
|
|
|
// 多个权限验证,满足一个则显示(v-auths="[xxx,xxx]")
|
|
@@ -41,7 +41,7 @@ export function authDirective(app: App) {
|
|
|
if (val === v) flag = true;
|
|
|
});
|
|
|
});
|
|
|
- if (!flag) el.parentNode.removeChild(el);
|
|
|
+ if (!flag) el.parentNode?.removeChild(el);
|
|
|
// if (!flag) el.classList.add('v-disabled')
|
|
|
},
|
|
|
});
|
|
@@ -51,7 +51,7 @@ export function authDirective(app: App) {
|
|
|
if (localStorage.btnNoAuth) return
|
|
|
const buttons = <string[]>router.currentRoute.value.meta.buttons
|
|
|
if (buttons.includes(allPermissions)) return
|
|
|
- !smallInBig(buttons, binding.value) && el.parentNode.removeChild(el)
|
|
|
+ !smallInBig(buttons, binding.value) && el.parentNode?.removeChild(el)
|
|
|
// !smallInBig(buttons, binding.value) && el.classList.add('v-disabled')
|
|
|
},
|
|
|
});
|