2025-09-25 14:58:50 +08:00
|
|
|
import { createApp } from "vue";
|
2025-09-28 14:19:57 +08:00
|
|
|
import ElementPlus from "element-plus";
|
|
|
|
|
import "element-plus/dist/index.css";
|
2025-09-25 14:58:50 +08:00
|
|
|
import App from "./App.vue";
|
|
|
|
|
import "./registerServiceWorker";
|
|
|
|
|
import router from "./router";
|
|
|
|
|
import store from "./store";
|
2025-10-07 13:31:06 +08:00
|
|
|
import { setupRouterGuards, setupTokenRefresh } from "@/utils/permission";
|
|
|
|
|
import { setupPermissionDirectives } from "@/directives/permission";
|
2025-09-25 14:58:50 +08:00
|
|
|
|
|
|
|
|
const app = createApp(App);
|
2025-10-07 13:31:06 +08:00
|
|
|
|
|
|
|
|
// 使用插件
|
2025-09-28 14:19:57 +08:00
|
|
|
app.use(ElementPlus);
|
2025-09-25 14:58:50 +08:00
|
|
|
app.use(store);
|
|
|
|
|
app.use(router);
|
|
|
|
|
|
2025-10-07 13:31:06 +08:00
|
|
|
// 设置权限指令
|
|
|
|
|
setupPermissionDirectives(app, store);
|
|
|
|
|
|
|
|
|
|
// 设置路由守卫
|
|
|
|
|
setupRouterGuards(router, store);
|
|
|
|
|
|
|
|
|
|
// 设置Token自动刷新
|
|
|
|
|
setupTokenRefresh(store);
|
|
|
|
|
|
2025-09-25 14:58:50 +08:00
|
|
|
app.mount("#app");
|