mirror of
https://github.com/pure-admin/pure-admin-thin.git
synced 2025-12-15 14:50:48 +08:00
release: update 3.6.0
This commit is contained in:
13
src/directives/auth/index.ts
Normal file
13
src/directives/auth/index.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { hasAuth } from "/@/router/utils";
|
||||
import { Directive, type DirectiveBinding } from "vue";
|
||||
|
||||
export const auth: Directive = {
|
||||
mounted(el: HTMLElement, binding: DirectiveBinding) {
|
||||
const { value } = binding;
|
||||
if (value) {
|
||||
!hasAuth(value) && el.parentNode.removeChild(el);
|
||||
} else {
|
||||
throw new Error("need auths! Like v-auth=\"['btn.add','btn.edit']\"");
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user