曹睿
2025-04-18 c277cb8ed0b6c7fa5da153e8a97bf1f756ffc412
1
2
3
4
5
6
7
8
9
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);
}