refactor: 全局注册自定义指令方式优化

Former-commit-id: 40c40fa90d88d9efad4ef2fb73b00d650427fd05
This commit is contained in:
haoxr
2023-03-23 07:42:48 +08:00
parent 382ee33328
commit 66499d06e9
3 changed files with 17 additions and 11 deletions

View File

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