web打包问题
This commit is contained in:
@@ -8,8 +8,6 @@ import './assets/css/common.scss'
|
||||
import App from './App.vue'
|
||||
import router from './router/'
|
||||
import { AES_SECRET_KEY } from './config/index'
|
||||
// @ts-ignore
|
||||
import { initAesEncrypt } from 'shared/utils'
|
||||
|
||||
// 导入需要的 Lucide 图标(用于动态组件)
|
||||
import {
|
||||
@@ -89,37 +87,41 @@ const lucideIcons = {
|
||||
|
||||
// 异步初始化应用
|
||||
async function initApp() {
|
||||
// 1. 初始化 AES 加密工具
|
||||
// 1. 创建 Vue 应用
|
||||
const app = createApp(App)
|
||||
|
||||
// 2. 注册 Pinia
|
||||
const pinia = createPinia()
|
||||
app.use(pinia)
|
||||
|
||||
// 3. 注册 Element Plus
|
||||
app.use(ElementPlus)
|
||||
|
||||
// 4. 注册 Lucide 图标(用于动态组件)
|
||||
for (const [name, component] of Object.entries(lucideIcons)) {
|
||||
app.component(name, component)
|
||||
}
|
||||
|
||||
// 5. 注册路由
|
||||
app.use(router)
|
||||
|
||||
// 6. 立即挂载应用(不等待 AES 初始化)
|
||||
app.mount('#app')
|
||||
|
||||
console.log('✅ Workcase 应用启动成功')
|
||||
|
||||
// 7. 后台初始化 AES 加密工具(不阻塞渲染)
|
||||
try {
|
||||
const { initAesEncrypt } = await import('shared/utils')
|
||||
await initAesEncrypt(AES_SECRET_KEY)
|
||||
console.log('✅ AES 加密工具初始化成功')
|
||||
} catch (error) {
|
||||
console.error('❌ AES 加密工具初始化失败:', error)
|
||||
}
|
||||
|
||||
// 2. 创建 Vue 应用
|
||||
const app = createApp(App)
|
||||
|
||||
// 3. 注册 Pinia
|
||||
const pinia = createPinia()
|
||||
app.use(pinia)
|
||||
|
||||
// 4. 注册 Element Plus
|
||||
app.use(ElementPlus)
|
||||
|
||||
// 5. 注册 Lucide 图标(用于动态组件)
|
||||
for (const [name, component] of Object.entries(lucideIcons)) {
|
||||
app.component(name, component)
|
||||
}
|
||||
|
||||
// 6. 注册路由
|
||||
app.use(router)
|
||||
|
||||
// 7. 挂载应用
|
||||
app.mount('#app')
|
||||
|
||||
console.log('✅ Workcase 应用启动成功')
|
||||
}
|
||||
|
||||
// 启动应用
|
||||
initApp()
|
||||
console.log('🚀 开始初始化 Workcase 应用...')
|
||||
initApp().catch(error => {
|
||||
console.error('❌ 应用初始化失败:', error)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user