You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
834 B
24 lines
834 B
|
2 months ago
|
import { Directive, DirectiveBinding } from 'vue';
|
||
|
|
import { useUserStore } from "@/store/modules/user";
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 按钮权限
|
||
|
|
*/
|
||
|
|
export const hasButton: Directive = {
|
||
|
|
mounted(el: HTMLElement, binding: DirectiveBinding) {
|
||
|
|
const userStore = useUserStore();
|
||
|
|
// const { value,oldValue } = binding;
|
||
|
|
// console.log("按钮权限",el,"-->",binding,"-->",value,"-->",oldValue,"-->",userStore.myPower);
|
||
|
|
console.log("按钮权限",el,"-->",binding,"-->","-->",userStore.myPower);
|
||
|
|
// if (value) {
|
||
|
|
// const requiredPerms = value; // DOM绑定需要的按钮权限标识
|
||
|
|
// const hasPerm = userStore.myPower.menuIdAry.some((perm: any) => {
|
||
|
|
// return requiredPerms.includes(perm);
|
||
|
|
// });
|
||
|
|
// if (!hasPerm) {
|
||
|
|
// el.parentNode?.removeChild(el);
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
}
|
||
|
|
}
|