19 lines
505 B
JavaScript
19 lines
505 B
JavaScript
|
|
import { ElMessage } from "element-plus";
|
||
|
|
import { useUserStore } from "@/pinia/user.js";
|
||
|
|
import pinia from "@/pinia/index.js";
|
||
|
|
|
||
|
|
export default {
|
||
|
|
install: (app) => {
|
||
|
|
app.directive("button", {
|
||
|
|
mounted(el, { value }) {
|
||
|
|
const userStore = useUserStore(pinia);
|
||
|
|
if (value) {
|
||
|
|
if (!userStore.getPermissions.includes(value)) {
|
||
|
|
el.parentNode.removeChild(el);
|
||
|
|
}
|
||
|
|
} else ElMessage.error("参数无效,请联系管理员");
|
||
|
|
},
|
||
|
|
});
|
||
|
|
},
|
||
|
|
};
|