vben
2020-12-13 27e50b47479af8eaeb4be020aeb0fcbdb4308295
src/main.ts
@@ -1,43 +1,53 @@
import { createApp } from 'vue';
import App from './App.vue';
import router, { setupRouter } from '/@/router';
import { setupStore } from '/@/store';
import { setupAntd } from '/@/setup/ant-design-vue';
import { setupErrorHandle } from '/@/setup/error-handle';
import { setupDirectives } from '/@/setup/directives';
import { setupGlobDirectives } from '/@/setup/directives';
import { setupI18n } from '/@/setup/i18n';
import { setupProdMockServer } from '../mock/_createProductionServer';
import { setApp } from '/@/setup/App';
import { isDevMode, isProdMode, isUseMock } from '/@/utils/env';
import { setupProdMockServer } from '../mock/_createProductionServer';
import { setApp } from './useApp';
import App from './App.vue';
import '/@/design/index.less';
import '/@/locales/index';
const app = createApp(App);
// ui
// Configure component library
setupAntd(app);
// router
// Multilingual configuration
setupI18n(app);
// Configure routing
setupRouter(app);
// store
// Configure vuex store
setupStore(app);
// Directives
setupDirectives(app);
// Register global directive
setupGlobDirectives(app);
// error-handle
// Configure global error handling
setupErrorHandle(app);
// Mount when the route is ready
router.isReady().then(() => {
  app.mount('#app');
});
// The development environment takes effect
if (isDevMode()) {
  app.config.performance = true;
  window.__APP__ = app;
}
// If you do not need to use the mock service in the production environment, you can comment the code
// If you do not need to setting the mock service in the production environment, you can comment the code
if (isProdMode() && isUseMock()) {
  setupProdMockServer();
}