import { createApp } from 'vue'
|
import { createPinia } from 'pinia'
|
|
import App from './App.vue'
|
import router from './router'
|
import { useAuthStore } from './stores/authStore'
|
import './styles/global.css'
|
|
const app = createApp(App)
|
const pinia = createPinia()
|
|
app.use(pinia)
|
app.use(router)
|
|
// 在挂载前恢复本地保存的登录状态。
|
// 必须早于 router 首次导航,否则刷新页面时路由守卫会误判为未登录并把用户踢回登录页。
|
useAuthStore().restore()
|
|
app.mount('#app')
|