超级管理员登录设置
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia' // [新增] 引入 Pinia
|
||||
import App from './App.vue'
|
||||
|
||||
// 1. 引入路由配置 (确保你已经创建了 src/router/index.ts)
|
||||
// 1. 引入路由配置
|
||||
import router from './router'
|
||||
|
||||
// 2. 引入 Element Plus (UI组件库)
|
||||
// 2. 引入 Element Plus
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
// 引入中文包
|
||||
@ -13,17 +14,31 @@ import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||
// 3. 引入图标
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||
|
||||
// 4. 引入全局样式 (通常建议加上,如果没有可忽略)
|
||||
import './style.css'
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
// 注册所有图标
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component)
|
||||
}
|
||||
// =========================================================
|
||||
// [关键修复] 注册顺序非常重要!
|
||||
// 1. 必须先注册 Pinia,因为 Router 的守卫中会用到 Store
|
||||
// =========================================================
|
||||
const pinia = createPinia()
|
||||
app.use(pinia)
|
||||
|
||||
// 使用插件
|
||||
// =========================================================
|
||||
// 2. 然后注册 Router
|
||||
// =========================================================
|
||||
app.use(router)
|
||||
|
||||
// 3. 注册 Element Plus
|
||||
app.use(ElementPlus, {
|
||||
locale: zhCn, // 设置为中文
|
||||
})
|
||||
|
||||
// 4. 注册所有图标
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component)
|
||||
}
|
||||
|
||||
app.mount('#app')
|
||||
Reference in New Issue
Block a user