2021-02-17 22:07:22 +08:00
|
|
|
import '/@/design/index.less';
|
2021-03-08 23:16:35 +08:00
|
|
|
import '@virtual/windi.css';
|
2021-02-17 22:07:22 +08:00
|
|
|
|
2021-03-16 23:02:14 +08:00
|
|
|
// Do not introduce` on-demand in local development?
|
2021-03-12 21:45:27 +08:00
|
|
|
// In the local development for on-demand introduction, the number of browser requests will increase by about 20%.
|
|
|
|
// Which may slow down the browser refresh.
|
|
|
|
// Therefore, all are introduced in local development, and only introduced on demand in the production environment
|
|
|
|
if (import.meta.env.DEV) {
|
|
|
|
import('ant-design-vue/dist/antd.less');
|
|
|
|
}
|
|
|
|
|
2020-09-28 20:19:10 +08:00
|
|
|
import { createApp } from 'vue';
|
2020-11-26 21:19:39 +08:00
|
|
|
import App from './App.vue';
|
2020-10-15 21:12:38 +08:00
|
|
|
|
2020-09-28 20:19:10 +08:00
|
|
|
import router, { setupRouter } from '/@/router';
|
|
|
|
import { setupStore } from '/@/store';
|
2021-01-10 21:23:21 +08:00
|
|
|
import { setupErrorHandle } from '/@/logics/error-handle';
|
2020-12-21 22:34:07 +08:00
|
|
|
import { setupGlobDirectives } from '/@/directives';
|
2021-01-09 23:28:52 +08:00
|
|
|
import { setupI18n } from '/@/locales/setupI18n';
|
|
|
|
import { registerGlobComp } from '/@/components/registerGlobComp';
|
2020-10-15 21:12:38 +08:00
|
|
|
|
2021-03-08 21:19:09 +08:00
|
|
|
// router-guard
|
|
|
|
import '/@/router/guard';
|
|
|
|
|
2021-03-07 20:21:31 +08:00
|
|
|
// Register icon Sprite
|
2021-03-05 23:12:01 +08:00
|
|
|
import 'vite-plugin-svg-icons/register';
|
|
|
|
|
2021-01-22 22:42:27 +08:00
|
|
|
import { isDevMode } from '/@/utils/env';
|
2020-11-18 22:41:59 +08:00
|
|
|
|
2021-02-27 23:08:12 +08:00
|
|
|
(async () => {
|
|
|
|
const app = createApp(App);
|
|
|
|
// Register global components
|
|
|
|
registerGlobComp(app);
|
2021-01-09 23:28:52 +08:00
|
|
|
|
2021-03-23 00:21:09 +08:00
|
|
|
// Multilingual configuration
|
|
|
|
await setupI18n(app);
|
|
|
|
|
2021-02-27 23:08:12 +08:00
|
|
|
// Configure routing
|
|
|
|
setupRouter(app);
|
2021-01-23 21:10:00 +08:00
|
|
|
|
2021-02-27 23:08:12 +08:00
|
|
|
// Configure vuex store
|
|
|
|
setupStore(app);
|
2020-11-18 22:41:59 +08:00
|
|
|
|
2021-02-27 23:08:12 +08:00
|
|
|
// Register global directive
|
|
|
|
setupGlobDirectives(app);
|
2020-09-28 20:19:10 +08:00
|
|
|
|
2021-02-27 23:08:12 +08:00
|
|
|
// Configure global error handling
|
|
|
|
setupErrorHandle(app);
|
2020-09-28 20:19:10 +08:00
|
|
|
|
2021-03-07 20:59:11 +08:00
|
|
|
// Mount when the route is ready
|
2021-03-23 00:21:09 +08:00
|
|
|
await router.isReady();
|
2020-10-18 21:55:21 +08:00
|
|
|
|
2020-12-22 22:13:03 +08:00
|
|
|
app.mount('#app', true);
|
2020-09-28 20:19:10 +08:00
|
|
|
|
2021-02-27 23:08:12 +08:00
|
|
|
// The development environment takes effect
|
|
|
|
if (isDevMode()) {
|
2021-03-07 23:18:33 +08:00
|
|
|
// app.config.performance = true;
|
2021-02-27 23:08:12 +08:00
|
|
|
window.__APP__ = app;
|
|
|
|
}
|
|
|
|
})();
|