2026-03-27 22:20:25 +08:00
|
|
|
|
import { createApp } from "vue"
|
|
|
|
|
|
import { createPinia } from "pinia"
|
|
|
|
|
|
import Antd from "ant-design-vue"
|
|
|
|
|
|
import "ant-design-vue/dist/reset.css"
|
|
|
|
|
|
import "./styles/global.scss"
|
|
|
|
|
|
import "./styles/theme.scss"
|
|
|
|
|
|
import App from "./App.vue"
|
|
|
|
|
|
import router from "./router"
|
|
|
|
|
|
import { useAuthStore } from "./stores/auth"
|
|
|
|
|
|
import { setupPermissionDirective } from "./directives/permission"
|
|
|
|
|
|
|
|
|
|
|
|
const app = createApp(App)
|
|
|
|
|
|
const pinia = createPinia()
|
|
|
|
|
|
|
|
|
|
|
|
app.use(pinia)
|
|
|
|
|
|
app.use(router)
|
|
|
|
|
|
app.use(Antd)
|
|
|
|
|
|
|
|
|
|
|
|
// 注册权限指令
|
|
|
|
|
|
setupPermissionDirective(app)
|
|
|
|
|
|
|
|
|
|
|
|
// 应用启动时初始化认证状态
|
|
|
|
|
|
// 如果有 token,自动获取用户信息
|
|
|
|
|
|
const authStore = useAuthStore()
|
|
|
|
|
|
authStore.initAuth().finally(() => {
|
|
|
|
|
|
app.mount("#app")
|
|
|
|
|
|
})
|