2021-12-17 11:55:42 +08:00
|
|
|
|
import { createApp } from 'vue'
|
|
|
|
|
import App from './App.vue'
|
|
|
|
|
import router, { setupRouter } from '@/router'
|
|
|
|
|
import i18n from '@/i18n/index'
|
|
|
|
|
import { setupStore } from '@/store'
|
2023-02-02 20:54:02 +08:00
|
|
|
|
import { setupNaive, setupDirectives, setupCustomComponents, initFunction } from '@/plugins'
|
2022-04-14 10:05:57 +08:00
|
|
|
|
import { GoAppProvider } from '@/components/GoAppProvider/index'
|
2021-12-20 14:29:29 +08:00
|
|
|
|
import { setHtmlTheme } from '@/utils'
|
2022-03-15 17:49:02 +08:00
|
|
|
|
|
2022-07-15 00:11:42 +08:00
|
|
|
|
// 引入全局样式
|
|
|
|
|
import '@/styles/pages/index.scss'
|
2022-03-15 17:49:02 +08:00
|
|
|
|
// 引入动画
|
2022-01-13 16:20:25 +08:00
|
|
|
|
import 'animate.css/animate.min.css'
|
2022-03-15 17:49:02 +08:00
|
|
|
|
// 引入标尺
|
|
|
|
|
import 'vue3-sketch-ruler/lib/style.css'
|
2022-01-13 16:20:25 +08:00
|
|
|
|
|
2021-12-14 15:53:30 +08:00
|
|
|
|
async function appInit() {
|
2022-04-14 10:05:57 +08:00
|
|
|
|
const goAppProvider = createApp(GoAppProvider)
|
2021-12-10 14:11:49 +08:00
|
|
|
|
|
2021-12-17 11:55:42 +08:00
|
|
|
|
const app = createApp(App)
|
2021-12-10 14:11:49 +08:00
|
|
|
|
|
|
|
|
|
// 注册全局常用的 naive-ui 组件
|
2021-12-17 11:55:42 +08:00
|
|
|
|
setupNaive(app)
|
2021-12-10 14:11:49 +08:00
|
|
|
|
|
2021-12-19 19:19:46 +08:00
|
|
|
|
// 注册全局自定义指令
|
2021-12-17 11:55:42 +08:00
|
|
|
|
setupDirectives(app)
|
2021-12-10 14:11:49 +08:00
|
|
|
|
|
2021-12-19 19:19:46 +08:00
|
|
|
|
// 注册全局自定义组件
|
|
|
|
|
setupCustomComponents(app)
|
|
|
|
|
|
2021-12-10 14:11:49 +08:00
|
|
|
|
// 挂载状态管理
|
2021-12-17 11:55:42 +08:00
|
|
|
|
setupStore(app)
|
2021-12-10 14:11:49 +08:00
|
|
|
|
|
2022-01-09 19:22:55 +08:00
|
|
|
|
// 解决路由守卫,Axios中可使用,Dialog,Message 等全局组件
|
2022-04-14 10:05:57 +08:00
|
|
|
|
goAppProvider.mount('#appProvider', true)
|
2021-12-10 14:11:49 +08:00
|
|
|
|
|
|
|
|
|
// 挂载路由
|
2022-01-09 19:22:55 +08:00
|
|
|
|
setupRouter(app)
|
2021-12-10 14:11:49 +08:00
|
|
|
|
|
|
|
|
|
// 路由准备就绪后挂载APP实例
|
2021-12-17 11:55:42 +08:00
|
|
|
|
await router.isReady()
|
|
|
|
|
|
|
|
|
|
// Store 准备就绪后处理主题色
|
|
|
|
|
setHtmlTheme()
|
|
|
|
|
|
|
|
|
|
// 语言注册
|
|
|
|
|
app.use(i18n)
|
2021-12-10 14:11:49 +08:00
|
|
|
|
|
2022-02-25 22:10:18 +08:00
|
|
|
|
// 挂载到页面
|
2021-12-17 11:55:42 +08:00
|
|
|
|
app.mount('#app', true)
|
2022-02-25 22:10:18 +08:00
|
|
|
|
|
|
|
|
|
// 挂载到 window
|
|
|
|
|
window['$vue'] = app
|
2021-12-10 14:11:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-02-17 18:15:00 +08:00
|
|
|
|
appInit().then(() => {
|
|
|
|
|
initFunction()
|
|
|
|
|
})
|
2023-02-02 20:54:02 +08:00
|
|
|
|
|