Vben
2021-04-08 ee1c3498587951a6a4cc0b49edb9dacf3f2af5c3
提交 | 用户 | age
4d7001 1 import '/@/design/index.less';
9e3ada 2 import '@virtual/windi.css';
4d7001 3
2f6253 4 import { createApp } from 'vue';
73c8e0 5 import App from './App.vue';
70fba7 6
2f6253 7 import router, { setupRouter } from '/@/router';
8 import { setupStore } from '/@/store';
eba557 9 import { setupErrorHandle } from '/@/logics/error-handle';
2e79c9 10 import { setupGlobDirectives } from '/@/directives';
99ac30 11 import { setupI18n } from '/@/locales/setupI18n';
V 12 import { registerGlobComp } from '/@/components/registerGlobComp';
b7ce74 13
V 14 // router-guard
15 import '/@/router/guard';
46e087 16
491f1f 17 // Register icon Sprite
9c2a2a 18 import 'vite-plugin-svg-icons/register';
V 19
ee4829 20 // Do not introduce` on-demand in local development?
V 21 // In the local development for on-demand introduction, the number of browser requests will increase by about 20%.
22 // Which may slow down the browser refresh.
23 // Therefore, all are introduced in local development, and only introduced on demand in the production environment
24 if (import.meta.env.DEV) {
25   import('ant-design-vue/dist/antd.less');
26 }
27
f6cef1 28 (async () => {
V 29   const app = createApp(App);
30   // Register global components
31   registerGlobComp(app);
46e087 32
fedd9c 33   // Multilingual configuration
V 34   await setupI18n(app);
35
f6cef1 36   // Configure routing
V 37   setupRouter(app);
f24422 38
f6cef1 39   // Configure vuex store
V 40   setupStore(app);
46e087 41
f6cef1 42   // Register global directive
V 43   setupGlobDirectives(app);
2f6253 44
f6cef1 45   // Configure global error handling
V 46   setupErrorHandle(app);
2f6253 47
d5d4c4 48   // Mount when the route is ready
e09068 49   // https://next.router.vuejs.org/api/#isready
fedd9c 50   await router.isReady();
710158 51
bd7b53 52   app.mount('#app', true);
39d629 53
V 54   if (import.meta.env.DEV) {
55     window.__APP__ = app;
56   }
f6cef1 57 })();