--添加测试模块

This commit is contained in:
2025-10-13 11:53:54 +08:00
parent c3c93fe308
commit e1326c7ce8
146 changed files with 11171 additions and 807 deletions

View File

@ -0,0 +1,32 @@
/**
* Global authority directive
* Used for fine-grained control of component permissions
* @Example v-auth="RoleEnum.TEST"
*/
import type { App, Directive, DirectiveBinding } from 'vue';
import { usePermission } from '/@/hooks/web/usePermission';
function isAllAuth(el: Element, binding: any) {
const { hasAllPermission } = usePermission();
const value = binding.value;
if (!value) return;
if (!hasAllPermission(value)) {
el.parentNode?.removeChild(el);
}
}
const mounted = (el: Element, binding: DirectiveBinding<any>) => {
isAllAuth(el, binding);
};
const allAuthDirective: Directive = {
mounted,
}
export function setupAllPermissionDirective(app: App) {
app.directive('allAuth', allAuthDirective);
}
export default allAuthDirective;