Blame view

src/main.ts 1.33 KB
陈文彬 authored
1
import { createApp } from 'vue';
vben authored
2
import App from './App.vue';
vben authored
3
陈文彬 authored
4
5
import router, { setupRouter } from '/@/router';
import { setupStore } from '/@/store';
vben authored
6
import { setupAntd } from '/@/setup/ant-design-vue';
vben authored
7
import { setupErrorHandle } from '/@/setup/error-handle';
vben authored
8
import { setupGlobDirectives } from '/@/directives';
9
import { setupI18n } from '/@/setup/i18n';
陈文彬 authored
10
import { setupProdMockServer } from '../mock/_createProductionServer';
11
import { setApp } from '/@/setup/App';
vben authored
12
vben authored
13
14
import { isDevMode, isProdMode, isUseMock } from '/@/utils/env';
陈文彬 authored
15
16
import '/@/design/index.less';
17
18
import '/@/locales/index';
陈文彬 authored
19
20
const app = createApp(App);
vben authored
21
// Configure component library
陈文彬 authored
22
setupAntd(app);
vben authored
23
24
25
26
// Multilingual configuration
setupI18n(app);
vben authored
27
// Configure routing
陈文彬 authored
28
setupRouter(app);
vben authored
29
30

// Configure vuex store
陈文彬 authored
31
32
setupStore(app);
vben authored
33
34
// Register global directive
setupGlobDirectives(app);
陈文彬 authored
35
vben authored
36
// Configure global error handling
vben authored
37
38
setupErrorHandle(app);
vben authored
39
// Mount when the route is ready
陈文彬 authored
40
router.isReady().then(() => {
41
  app.mount('#app', true);
陈文彬 authored
42
43
});
vben authored
44
// The development environment takes effect
陈文彬 authored
45
46
47
48
49
if (isDevMode()) {
  app.config.performance = true;
  window.__APP__ = app;
}
vben authored
50
// If you do not need to setting the mock service in the production environment, you can comment the code
陈文彬 authored
51
52
53
if (isProdMode() && isUseMock()) {
  setupProdMockServer();
}
vben authored
54
// Used to share app instances in other modules
55
setApp(app);