36 lines
872 B
TypeScript
36 lines
872 B
TypeScript
import { createApp } from 'vue'
|
|
import { createPinia } from 'pinia'
|
|
import ElementPlus from 'element-plus'
|
|
import 'element-plus/dist/index.css'
|
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
|
|
|
import App from './App.vue'
|
|
import router from './router'
|
|
import { registerComponents } from '@/components'
|
|
|
|
// 创建Vue应用实例
|
|
const app = createApp(App)
|
|
|
|
// 注册Element Plus图标
|
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
|
app.component(key, component)
|
|
}
|
|
|
|
// 使用插件
|
|
app.use(createPinia())
|
|
app.use(router)
|
|
app.use(ElementPlus)
|
|
|
|
// 注册自定义组件
|
|
registerComponents(app)
|
|
|
|
// 挂载应用
|
|
app.mount('#app')
|
|
|
|
// 添加全局错误处理
|
|
app.config.errorHandler = (error, instance, info) => {
|
|
console.error('应用错误:', error)
|
|
console.error('错误信息:', info)
|
|
console.error('组件实例:', instance)
|
|
}
|