Sanakey
5 天以前 2af71bcf522c485ea005184c977986374a7dcc4a
src/main.ts
@@ -1,60 +1,72 @@
import '/@/design/index.less';
import '@virtual/windi.css';
// Do not introduce` on-demand in local development?
// 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');
}
import 'uno.css';
import '@/design/index.less';
import '@/components/VxeTable/src/css/index.scss';
import 'ant-design-vue/dist/reset.css';
// Register icon sprite
import 'virtual:svg-icons-register';
import { createApp } from 'vue';
import { registerGlobComp } from '@/components/registerGlobComp';
import { setupGlobDirectives } from '@/directives';
import { setupI18n } from '@/locales/setupI18n';
import { setupErrorHandle } from '@/logics/error-handle';
import { initAppConfigStore } from '@/logics/initAppConfig';
import { router, setupRouter } from '@/router';
import { setupRouterGuard } from '@/router/guard';
import { setupStore } from '@/store';
import VueCookies from 'vue-cookies'
import Antd from 'ant-design-vue';
import App from './App.vue';
import router, { setupRouter } from '/@/router';
import { setupStore } from '/@/store';
import { setupErrorHandle } from '/@/logics/error-handle';
import { setupGlobDirectives } from '/@/directives';
import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp';
// router-guard
import '/@/router/guard';
import Logger from '@/utils/logger';
// Register icon Sprite
import 'vite-plugin-svg-icons/register';
import { isDevMode } from '/@/utils/env';
(async () => {
// 将 Logger 添加到 window 对象中
window.Logger = Logger;
async function bootstrap() {
  const app = createApp(App);
  app.use(Antd)
  app.use(VueCookies);
  // 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);
  // Configure vuex store
  setupStore(app);
  // router-guard
  // 路由守卫
  setupRouterGuard(router);
  // Register global directive
  // 注册全局指令
  setupGlobDirectives(app);
  // Configure global error handling
  // 配置全局错误处理
  setupErrorHandle(app);
  // Mount when the route is ready
  await router.isReady();
  // https://next.router.vuejs.org/api/#isready
  // await router.isReady();
  app.mount('#app', true);
  app.mount('#app');
}
  // The development environment takes effect
  if (isDevMode()) {
    // app.config.performance = true;
    window.__APP__ = app;
  }
})();
bootstrap();