refactor: refactored multi-language modules to support lazy loading and remote loading

This commit is contained in:
Vben
2021-02-27 23:08:12 +08:00
parent f57eb944ed
commit f6cef1088d
47 changed files with 353 additions and 284 deletions

View File

@@ -14,33 +14,36 @@ import { registerGlobComp } from '/@/components/registerGlobComp';
import { isDevMode } from '/@/utils/env';
const app = createApp(App);
(async () => {
const app = createApp(App);
// Register global components
registerGlobComp(app);
// Register global components
registerGlobComp(app);
// Multilingual configuration
setupI18n(app);
// Configure routing
setupRouter(app);
// Configure routing
setupRouter(app);
// Configure vuex store
setupStore(app);
// Configure vuex store
setupStore(app);
// Register global directive
setupGlobDirectives(app);
// Register global directive
setupGlobDirectives(app);
// Configure global error handling
setupErrorHandle(app);
// 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
router.isReady().then(() => {
app.mount('#app', true);
});
// The development environment takes effect
if (isDevMode()) {
app.config.performance = true;
window.__APP__ = app;
}
// The development environment takes effect
if (isDevMode()) {
app.config.performance = true;
window.__APP__ = app;
}
})();