1这 是directive.js注册的的
import type { Directive, DirectiveBinding } from "vue";
import useUserStore from "@/stores/user";
import { createPinia } from "pinia";
const userStore = useUserStore(createPinia());
// buttonList: ["user.add", "user.del", "user.edit", "user.res"],是一个数组,包含是否有权限的判断
//1自定义指令--bu展示
const hasPromise: Directive = {
mounted(el: HTMLElement, option: DirectiveBinding) {
if (userStore.buttonList.includes(option.value)) {
el.parentNode!.removeChild(el);
}
},
};
// //2自定义指令--disbale
const isdisable: Directive
标签:el,const,自定义,Directive,user,vue3,import,全局
From: https://blog.csdn.net/jieweiwujie/article/details/142351109