main.ts
1.33 KB
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
import { createApp } from 'vue';
import App from './App.vue';
import router, { setupRouter } from '/@/router';
import { setupStore } from '/@/store';
import { setupAntd } from '/@/setup/ant-design-vue';
import { setupErrorHandle } from '/@/setup/error-handle';
import { setupGlobDirectives } from '/@/directives';
import { setupI18n } from '/@/setup/i18n';
import { setupProdMockServer } from '../mock/_createProductionServer';
import { setApp } from '/@/setup/App';
import { isDevMode, isProdMode, isUseMock } from '/@/utils/env';
import '/@/design/index.less';
import '/@/locales/index';
const app = createApp(App);
// Configure component library
setupAntd(app);
// Multilingual configuration
setupI18n(app);
// Configure routing
setupRouter(app);
// Configure vuex store
setupStore(app);
// Register global directive
setupGlobDirectives(app);
// Configure global error handling
setupErrorHandle(app);
// Mount when the route is ready
router.isReady().then(() => {
app.mount('#app');
});
// The development environment takes effect
if (isDevMode()) {
app.config.performance = true;
window.__APP__ = app;
}
// If you do not need to setting the mock service in the production environment, you can comment the code
if (isProdMode() && isUseMock()) {
setupProdMockServer();
}
// Used to share app instances in other modules
setApp(app);