Files
pqs-9100_client/frontend/src/main.ts

70 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-10-21 14:43:37 +08:00
import { createApp } from 'vue'
import App from './App.vue'
2024-08-22 11:27:06 +08:00
// reset style sheet
2024-10-21 14:43:37 +08:00
import '@/styles/reset.scss'
2024-08-22 11:27:06 +08:00
// CSS common style sheet
2024-10-21 14:43:37 +08:00
import '@/styles/common.scss'
2024-08-22 11:27:06 +08:00
// iconfont css
2024-10-21 14:43:37 +08:00
import '@/assets/iconfont/iconfont.scss'
2024-08-22 11:27:06 +08:00
// font css
2024-10-21 14:43:37 +08:00
import '@/assets/fonts/font.scss'
2024-08-22 11:27:06 +08:00
// element css
2024-10-21 14:43:37 +08:00
import 'element-plus/dist/index.css'
2024-08-22 11:27:06 +08:00
// element dark css
2024-10-21 14:43:37 +08:00
import 'element-plus/theme-chalk/dark/css-vars.css'
2024-08-22 11:27:06 +08:00
// custom element dark css
2024-10-21 14:43:37 +08:00
import '@/styles/element-dark.scss'
2024-08-22 11:27:06 +08:00
// custom element css
2024-10-21 14:43:37 +08:00
import '@/styles/element.scss'
2024-08-22 11:27:06 +08:00
// svg icons
2024-10-21 14:43:37 +08:00
import 'virtual:svg-icons-register'
2024-08-22 11:27:06 +08:00
// element plus
2024-10-21 14:43:37 +08:00
import ElementPlus from 'element-plus'
2024-08-22 11:27:06 +08:00
// element icons
2024-10-21 14:43:37 +08:00
import * as Icons from '@element-plus/icons-vue'
2024-08-22 11:27:06 +08:00
// custom directives
2024-10-21 14:43:37 +08:00
import directives from '@/directives/index'
2024-08-22 11:27:06 +08:00
// vue Router
2024-10-21 14:43:37 +08:00
import router from '@/routers'
2024-08-22 11:27:06 +08:00
// vue i18n
2024-10-21 14:43:37 +08:00
import I18n from '@/languages/index'
2024-08-22 11:27:06 +08:00
// pinia store
2024-10-21 14:43:37 +08:00
import pinia from '@/stores'
2024-08-22 11:27:06 +08:00
// errorHandler
2024-10-21 14:43:37 +08:00
import errorHandler from '@/utils/errorHandler'
2024-08-22 11:27:06 +08:00
2024-10-09 20:37:03 +08:00
import registerGlobComp from '@/components'
2024-10-21 14:43:37 +08:00
const app = createApp(App)
2024-08-22 11:27:06 +08:00
2024-10-16 15:33:14 +08:00
// 自定义警告处理程序,忽略所有警告
2024-10-21 14:43:37 +08:00
app.config.warnHandler = () => {
2024-10-16 15:33:14 +08:00
}
2024-10-21 14:43:37 +08:00
// if (import.meta.env.VUE_APP_SILENCE_WARNINGS === true) {
// }
2024-10-16 15:33:14 +08:00
2024-10-21 14:43:37 +08:00
app.config.errorHandler = errorHandler
2024-08-22 11:27:06 +08:00
// register the element Icons component
Object.keys(Icons).forEach(key => {
2024-10-21 14:43:37 +08:00
app.component(key, Icons[key as keyof typeof Icons])
})
2024-08-22 11:27:06 +08:00
2024-10-09 20:37:03 +08:00
const setupAll = async () => {
2024-10-21 14:43:37 +08:00
app
.use(ElementPlus)
.use(directives)
.use(router) // 使用路由
.use(I18n)
.use(pinia)
.use(registerGlobComp) // 使用全局自定义组件
2024-10-09 20:37:03 +08:00
2024-10-21 14:43:37 +08:00
//待路由初始化完毕后挂载app
await router.isReady()
2024-10-09 20:37:03 +08:00
}
//挂载app
setupAll().then(() => {
2024-10-21 14:43:37 +08:00
app.mount('#app')
2024-10-09 20:37:03 +08:00
})