Vben
2021-03-10 9aa1be821be13168026e0a22878b12297349bbd1
src/main.ts
@@ -1,5 +1,5 @@
import '/@/design/index.less';
import 'windi.css';
import '@virtual/windi.css';
import { createApp } from 'vue';
import App from './App.vue';
@@ -9,18 +9,23 @@
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';
// Register icon Sprite
import 'vite-plugin-svg-icons/register';
import { isDevMode } from '/@/utils/env';
(async () => {
  const app = createApp(App);
  // Register global components
  registerGlobComp(app);
  // Multilingual configuration
  await setupI18n(app);
  // Configure routing
  setupRouter(app);
@@ -34,18 +39,14 @@
  // Configure global error handling
  setupErrorHandle(app);
  await Promise.all([
    // Multilingual configuration
    setupI18n(app),
    // Mount when the route is ready
    router.isReady(),
  ]);
  // Mount when the route is ready
  await router.isReady();
  app.mount('#app', true);
  // The development environment takes effect
  if (isDevMode()) {
    app.config.performance = true;
    // app.config.performance = true;
    window.__APP__ = app;
  }
})();