import { createApp } from "vue";
|
import { createPinia } from "pinia";
|
import ElementPlus from "element-plus";
|
import zhCn from "element-plus/es/locale/lang/zh-cn";
|
import "element-plus/dist/index.css";
|
import App from "./App.vue";
|
import router from "./router";
|
import { useAuthStore } from "./stores/auth";
|
|
const app = createApp(App);
|
const pinia = createPinia();
|
app.use(pinia);
|
app.use(router);
|
app.use(ElementPlus, { locale: zhCn });
|
app.directive("permission", {
|
mounted(el, binding) {
|
const auth = useAuthStore();
|
const values = Array.isArray(binding.value) ? binding.value : [binding.value];
|
if (!auth.hasAnyPermission(values)) {
|
el.parentNode?.removeChild(el);
|
}
|
},
|
});
|
app.mount("#app");
|