feat: 添加自定义权限指令,工作台模块添加权限控制

This commit is contained in:
ray
2024-11-19 13:02:20 +08:00
parent 3e496f75d7
commit 0288e975dc
7 changed files with 104 additions and 18 deletions

10
src/directive/index.ts Normal file
View File

@@ -0,0 +1,10 @@
import type { App } from "vue";
import { hasPerm, hasRole } from "./permission";
// 全局注册 directive
export function setupDirective(app: App<Element>) {
// 使 v-hasPerm 在所有组件中都可用
app.directive("hasPerm", hasPerm);
app.directive("hasRole", hasRole);
}