go-view/src/main.ts
2022-07-15 00:11:42 +08:00

57 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { createApp } from 'vue'
import App from './App.vue'
import router, { setupRouter } from '@/router'
import i18n from '@/i18n/index'
import { setupStore } from '@/store'
import { setupNaive, setupDirectives, setupCustomComponents } from '@/plugins'
import { GoAppProvider } from '@/components/GoAppProvider/index'
import { setHtmlTheme } from '@/utils'
// 引入全局样式
import '@/styles/pages/index.scss'
// 引入动画
import 'animate.css/animate.min.css'
// 引入标尺
import 'vue3-sketch-ruler/lib/style.css'
async function appInit() {
const goAppProvider = createApp(GoAppProvider)
const app = createApp(App)
// 注册全局常用的 naive-ui 组件
setupNaive(app)
// 注册全局自定义指令
setupDirectives(app)
// 注册全局自定义组件
setupCustomComponents(app)
// 挂载状态管理
setupStore(app)
// 解决路由守卫Axios中可使用DialogMessage 等全局组件
goAppProvider.mount('#appProvider', true)
// 挂载路由
setupRouter(app)
// 路由准备就绪后挂载APP实例
await router.isReady()
// Store 准备就绪后处理主题色
setHtmlTheme()
// 语言注册
app.use(i18n)
// 挂载到页面
app.mount('#app', true)
// 挂载到 window
window['$vue'] = app
}
void appInit()