vue-vben-admin/src/main.ts

47 lines
1021 B
TypeScript
Raw Normal View History

2021-02-17 22:07:22 +08:00
import '/@/design/index.less';
import 'windi.css';
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
import { isDevMode } from '/@/utils/env';
2020-11-18 22:41:59 +08:00
2020-09-28 20:19:10 +08:00
const app = createApp(App);
2021-02-22 23:04:47 +08:00
// Register global components
2021-01-09 23:28:52 +08:00
registerGlobComp(app);
// Multilingual configuration
setupI18n(app);
2021-01-23 21:10:00 +08:00
2020-11-18 22:41:59 +08:00
// Configure routing
2020-09-28 20:19:10 +08:00
setupRouter(app);
2020-11-18 22:41:59 +08:00
// Configure vuex store
2020-09-28 20:19:10 +08:00
setupStore(app);
2020-11-18 22:41:59 +08:00
// Register global directive
setupGlobDirectives(app);
2020-09-28 20:19:10 +08:00
2020-11-18 22:41:59 +08:00
// Configure global error handling
2020-10-18 21:55:21 +08:00
setupErrorHandle(app);
2020-11-18 22:41:59 +08:00
// Mount when the route is ready
2020-09-28 20:19:10 +08:00
router.isReady().then(() => {
app.mount('#app', true);
2020-09-28 20:19:10 +08:00
});
2020-11-18 22:41:59 +08:00
// The development environment takes effect
2020-09-28 20:19:10 +08:00
if (isDevMode()) {
app.config.performance = true;
window.__APP__ = app;
}