im 管理后台

This commit is contained in:
richjohnrambo
2026-08-11 23:13:51 +08:00
parent 0397fe5f22
commit 331a55751d
1407 changed files with 162069 additions and 2 deletions
+19
View File
@@ -0,0 +1,19 @@
import { ObjectDirective } from 'vue';
import { usePermission } from '@/hooks/web/usePermission';
export const permission: ObjectDirective = {
mounted(el: HTMLButtonElement, binding) {
if (binding.value == undefined) return;
const { action, effect } = binding.value;
const { hasPermission } = usePermission();
if (!hasPermission(action)) {
if (effect == 'disabled') {
el.disabled = true;
el.style['disabled'] = 'disabled';
el.classList.add('n-button--disabled');
} else {
el.remove();
}
}
},
};