Files
wecom_it_smart_desk/frontend-admin/src/main.ts
T

53 lines
2.0 KiB
TypeScript

// =============================================================================
// 企微IT智能服务台 — 管理后台应用入口
// =============================================================================
// 说明:Vue3 应用入口文件,负责:
// 1. 创建 Vue 应用实例
// 2. 注册 ElementPlus 组件库
// 3. 注册 Pinia 状态管理
// 4. 注册 Vue Router 路由
// 5. 注册全局图标组件
// 6. 挂载到 DOM
import { createApp } from 'vue'
// 根组件
import App from './App.vue'
// 路由配置
import router from './router'
// Pinia 状态管理
import { createPinia } from 'pinia'
// ElementPlus 组件库
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
// ElementPlus 中文语言包
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
// ElementPlus 图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// 全局样式
import './styles/global.css'
// 创建 Vue 应用实例
const app = createApp(App)
// --------------------------------------------------------------------------
// 注册 ElementPlus 图标组件(全局注册,模板中可直接使用)
// --------------------------------------------------------------------------
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component)
}
// --------------------------------------------------------------------------
// 注册插件
// --------------------------------------------------------------------------
// Pinia: 状态管理(管理员信息、配置项、坐席管理等)
app.use(createPinia())
// Vue Router: 路由管理(页面跳转)
app.use(router)
// ElementPlus: UI 组件库(表格、表单、对话框等)+ 中文语言包
app.use(ElementPlus, { locale: zhCn })
// --------------------------------------------------------------------------
// 挂载应用到 DOM
// --------------------------------------------------------------------------
app.mount('#app')