Xing Jinwen | ff16b1e | 2025-06-05 00:29:26 +0800 | [diff] [blame] | 1 | import { createApp } from 'vue'
|
| 2 | import App from './App.vue'
|
| 3 | import router from './router'
|
| 4 | import store from './store'
|
| 5 |
|
| 6 | // 引入Element Plus
|
| 7 | import ElementPlus from 'element-plus'
|
| 8 | import 'element-plus/dist/index.css'
|
| 9 | import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
| 10 |
|
| 11 | const app = createApp(App)
|
| 12 |
|
| 13 | // 注册所有Element Plus图标
|
| 14 | for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
| 15 | app.component(key, component)
|
| 16 | }
|
| 17 |
|
| 18 | app.use(ElementPlus)
|
| 19 | app.use(store) // 确保这行存在且在 router 之前
|
| 20 | app.use(router)
|
| 21 |
|
| 22 | // 应用启动时恢复登录状态
|
| 23 | if (store && store.dispatch) {
|
| 24 | store.dispatch('auth/restoreLoginState')
|
| 25 | }
|
| 26 |
|
2081595154 | f846f91 | 2025-06-04 17:35:21 +0800 | [diff] [blame] | 27 | app.mount('#app') |