42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import { createApp } from 'vue'
|
|
import { createPinia } from 'pinia'
|
|
import ElementPlus from 'element-plus'
|
|
import 'element-plus/dist/index.css'
|
|
import 'virtual:svg-icons-register'
|
|
|
|
import App from './App.vue'
|
|
import router from './router'
|
|
import './permission' // permission control
|
|
import SvgIcon from '@/components/SvgIcon/index.vue'
|
|
import i18n, { loadServerMessages } from '@/lang/index'
|
|
|
|
import '@/styles/index.scss' // global css
|
|
|
|
const app = createApp(App)
|
|
|
|
let errorHandlerDepth = 0
|
|
app.config.errorHandler = (err, _instance, info) => {
|
|
if (errorHandlerDepth > 0) {
|
|
// 避免错误处理过程中再次抛错导致无限递归与栈溢出
|
|
console.error('[Vue] errorHandler re-entry', err)
|
|
return
|
|
}
|
|
errorHandlerDepth += 1
|
|
try {
|
|
console.error(info ? `[Vue] ${info}` : '[Vue] error', err)
|
|
} finally {
|
|
errorHandlerDepth -= 1
|
|
}
|
|
}
|
|
|
|
app.component('svg-icon', SvgIcon)
|
|
app.use(createPinia())
|
|
app.use(router)
|
|
app.use(i18n)
|
|
app.use(ElementPlus)
|
|
|
|
// 加载服务器国际化翻译
|
|
loadServerMessages()
|
|
|
|
app.mount('#app')
|