mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-10-13 21:33:42 +08:00
17 lines
429 B
TypeScript
17 lines
429 B
TypeScript
import type { App, Directive } from 'vue';
|
|
import { useAuthStore } from '@/store';
|
|
|
|
export default function setupLoginDirective(app: App) {
|
|
const auth = useAuthStore();
|
|
|
|
const loginDirective: Directive<HTMLElement, Auth.RoleType | undefined> = {
|
|
mounted(el: HTMLElement, binding) {
|
|
if (binding.value !== auth.userInfo.userRole) {
|
|
el.remove();
|
|
}
|
|
}
|
|
};
|
|
|
|
app.directive('login', loginDirective);
|
|
}
|