Blame view

src/main.ts 1.65 KB
vben authored
1
import '/@/design/index.less';
2
3
4
import 'virtual:windi-base.css';
import 'virtual:windi-components.css';
import 'virtual:windi-utilities.css';
5
6
// Register icon sprite
import 'virtual:svg-icons-register';
vben authored
7
import App from './App.vue';
Vben authored
8
import { createApp } from 'vue';
9
import { initAppConfigStore } from '/@/logics/initAppConfig';
10
import { setupErrorHandle } from '/@/logics/error-handle';
Vben authored
11
import { router, setupRouter } from '/@/router';
Vben authored
12
import { setupRouterGuard } from '/@/router/guard';
陈文彬 authored
13
import { setupStore } from '/@/store';
vben authored
14
import { setupGlobDirectives } from '/@/directives';
vben authored
15
16
import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp';
vben authored
17
18
19
20
// 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 .
21
22
23
24
if (import.meta.env.DEV) {
  import('ant-design-vue/dist/antd.less');
}
vben authored
25
async function bootstrap() {
26
  const app = createApp(App);
Vben authored
27
28
  // Configure store
Vben authored
29
30
  setupStore(app);
31
  // Initialize internal system configuration
32
33
  initAppConfigStore();
34
35
  // Register global components
  registerGlobComp(app);
vben authored
36
Vben authored
37
  // Multilingual configuration
38
  // Asynchronous case: language files may be obtained from the server side
Vben authored
39
40
  await setupI18n(app);
41
42
  // Configure routing
  setupRouter(app);
vben authored
43
Vben authored
44
  // router-guard
45
  setupRouterGuard(router);
vben authored
46
47
48
  // Register global directive
  setupGlobDirectives(app);
陈文彬 authored
49
50
51
  // Configure global error handling
  setupErrorHandle(app);
陈文彬 authored
52
Vben authored
53
  // https://next.router.vuejs.org/api/#isready
54
  // await router.isReady();
vben authored
55
vben authored
56
  app.mount('#app');
vben authored
57
58
}
vben authored
59
bootstrap();