vben
2021-08-24 2884e863ce826cd92cd782f40cdee31588bc6d32
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
import '/@/design/index.less';
import 'virtual:windi-base.css';
import 'virtual:windi-components.css';
import 'virtual:windi-utilities.css';
import 'virtual:windi-devtools';
// Register icon sprite
import 'virtual:svg-icons-register';
import App from './App.vue';
import { createApp } from 'vue';
import { initAppConfigStore } from '/@/logics/initAppConfig';
import { setupErrorHandle } from '/@/logics/error-handle';
import { router, setupRouter } from '/@/router';
import { setupRouterGuard } from '/@/router/guard';
import { setupStore } from '/@/store';
import { setupGlobDirectives } from '/@/directives';
import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp';
 
// Importing on demand in local development will increase the number of browser requests by around 20%.
// This may slow down the browser refresh speed.
// Therefore, only enable on-demand importing in production environments .
if (import.meta.env.DEV) {
  import('ant-design-vue/dist/antd.less');
}
 
async function bootstrap() {
  const app = createApp(App);
 
  // Configure store
  setupStore(app);
 
  // Initialize internal system configuration
  initAppConfigStore();
 
  // Register global components
  registerGlobComp(app);
 
  // Multilingual configuration
  // Asynchronous case: language files may be obtained from the server side
  await setupI18n(app);
 
  // Configure routing
  setupRouter(app);
 
  // router-guard
  setupRouterGuard(router);
 
  // Register global directive
  setupGlobDirectives(app);
 
  // Configure global error handling
  setupErrorHandle(app);
 
  // https://next.router.vuejs.org/api/#isready
  // await router.isReady();
 
  app.mount('#app', true);
}
 
bootstrap();