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

56 lines
2.1 KiB
TypeScript

// =============================================================================
// 企微IT智能服务台 — 坐席工作台应用入口
// =============================================================================
// 说明:Vue3 应用入口文件,负责:
// 1. 创建 Vue 应用实例
// 2. 注册 ElementPlus 组件库
// 3. 注册 Pinia 状态管理
// 4. 注册 Vue Router 路由
// 5. 挂载到 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 图标组件
// --------------------------------------------------------------------------
// 遍历所有图标,全局注册为组件,方便在模板中直接使用
// 如 <el-icon><ChatDotRound /></el-icon>
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
// --------------------------------------------------------------------------
// 将 Vue 应用挂载到 index.html 中的 #app 元素
app.mount('#app')