adeewu
2022-09-29 2abc8275c6f9c3d52361b75d7e9fe73bcae85a5f
src/main.ts
@@ -1,7 +1,7 @@
import 'virtual:windi-base.css';
import 'virtual:windi-components.css';
import '/@/design/index.less';
// Register windi
import 'virtual:windi.css';
import 'virtual:windi-utilities.css';
// Register icon sprite
import 'virtual:svg-icons-register';
import App from './App.vue';
@@ -15,46 +15,53 @@
import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp';
// Do not introduce on-demand in local development?
// In the local development for introduce on-demand, 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');
import { isDevMode } from './utils/env';
if (isDevMode()) {
  import('ant-design-vue/es/style');
}
async function bootstrap() {
  const app = createApp(App);
  // Configure store
  // 配置 store
  setupStore(app);
  // Initialize internal system configuration
  // 初始化内部系统配置
  initAppConfigStore();
  // Register global components
  // 注册全局组件
  registerGlobComp(app);
  // Multilingual configuration
  // 多语言配置
  // Asynchronous case: language files may be obtained from the server side
  // 异步案例:语言文件可能从服务器端获取
  await setupI18n(app);
  // Configure routing
  // 配置路由
  setupRouter(app);
  // router-guard
  // 路由守卫
  setupRouterGuard(router);
  // Register global directive
  // 注册全局指令
  setupGlobDirectives(app);
  // Configure global error handling
  // 配置全局错误处理
  setupErrorHandle(app);
  // Mount when the route is ready
  // https://next.router.vuejs.org/api/#isready
  await router.isReady();
  // await router.isReady();
  app.mount('#app', true);
  app.mount('#app');
}
void bootstrap();
bootstrap();