-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmain.ts
62 lines (47 loc) · 1.67 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import '/@/design/index.less';
import 'virtual:windi.css';
import { createApp } from 'vue';
import App from './App.vue';
import { initAppConfigStore } from '/@/logics/initAppConfig';
import router, { setupRouter } from '/@/router';
import { setupRouterGuard } from '/@/router/guard';
import { setupStore } from '/@/store';
import { setupErrorHandle } from '/@/logics/error-handle';
import { setupGlobDirectives } from '/@/directives';
import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp';
// Register icon Sprite
import 'vite-plugin-svg-icons/register';
// Do not introduce` on-demand in local development?
// In the local development for on-demand introduction, the number of browser requests will increase by about 20%.
// Which may slow down the browser refresh.
// Therefore, all are introduced in local development, and only introduced on demand in the production environment
if (import.meta.env.DEV) {
import('ant-design-vue/dist/antd.less');
}
(async () => {
const app = createApp(App);
// Configure vuex store
setupStore(app);
// Initialize internal system configuration
initAppConfigStore();
// Register global components
registerGlobComp(app);
// Multilingual configuration
await setupI18n(app);
// Configure routing
setupRouter(app);
// router-guard
setupRouterGuard();
// Register global directive
setupGlobDirectives(app);
// Configure global error handling
setupErrorHandle(app);
// Mount when the route is ready
// https://next.router.vuejs.org/api/#isready
await router.isReady();
app.mount('#app', true);
if (import.meta.env.DEV) {
window.__APP__ = app;
}
})();