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