main.ts 1.1 KB
Newer Older
V
vben 已提交
1 2 3
import '/@/design/index.less';
import 'windi.css';

陈文彬 已提交
4
import { createApp } from 'vue';
V
vben 已提交
5
import App from './App.vue';
V
vben 已提交
6

陈文彬 已提交
7 8
import router, { setupRouter } from '/@/router';
import { setupStore } from '/@/store';
V
vben 已提交
9
import { setupErrorHandle } from '/@/logics/error-handle';
V
vben 已提交
10
import { setupGlobDirectives } from '/@/directives';
V
vben 已提交
11 12 13
import { setupI18n } from '/@/locales/setupI18n';

import { registerGlobComp } from '/@/components/registerGlobComp';
V
vben 已提交
14

V
Vben 已提交
15 16
import 'vite-plugin-svg-icons/register';

17
import { isDevMode } from '/@/utils/env';
V
vben 已提交
18

19 20
(async () => {
  const app = createApp(App);
陈文彬 已提交
21

22 23
  // Register global components
  registerGlobComp(app);
V
vben 已提交
24

25 26
  // Configure routing
  setupRouter(app);
V
vben 已提交
27

28 29
  // Configure vuex store
  setupStore(app);
V
vben 已提交
30

31 32
  // Register global directive
  setupGlobDirectives(app);
陈文彬 已提交
33

34 35
  // Configure global error handling
  setupErrorHandle(app);
陈文彬 已提交
36

37 38 39 40 41 42
  await Promise.all([
    // Multilingual configuration
    setupI18n(app),
    // Mount when the route is ready
    router.isReady(),
  ]);
V
vben 已提交
43

44
  app.mount('#app', true);
陈文彬 已提交
45

46 47 48 49 50 51
  // The development environment takes effect
  if (isDevMode()) {
    app.config.performance = true;
    window.__APP__ = app;
  }
})();