2024-06-08 11:49:06 +00:00
|
|
|
import { createApp } from 'vue';
|
2024-05-24 15:11:03 +00:00
|
|
|
|
2024-06-08 11:49:06 +00:00
|
|
|
import { setupI18n } from '@vben/locales';
|
|
|
|
import '@vben/styles';
|
2024-06-01 15:15:29 +00:00
|
|
|
import { preferences } from '@vben-core/preferences';
|
|
|
|
|
|
|
|
import { setupStore } from '@/store';
|
2024-05-24 15:11:03 +00:00
|
|
|
|
|
|
|
import App from './app.vue';
|
|
|
|
import { router } from './router';
|
|
|
|
|
2024-05-25 14:43:22 +00:00
|
|
|
async function bootstrap(namespace: string) {
|
2024-05-24 15:11:03 +00:00
|
|
|
const app = createApp(App);
|
|
|
|
|
|
|
|
// 国际化 i18n 配置
|
2024-06-01 15:15:29 +00:00
|
|
|
await setupI18n(app, { defaultLocale: preferences.app.locale });
|
2024-05-24 15:11:03 +00:00
|
|
|
|
|
|
|
// 配置 pinia-store
|
2024-05-25 14:43:22 +00:00
|
|
|
await setupStore(app, { namespace });
|
2024-05-24 15:11:03 +00:00
|
|
|
|
|
|
|
// 配置路由及路由守卫
|
|
|
|
app.use(router);
|
|
|
|
|
|
|
|
app.mount('#app');
|
|
|
|
|
|
|
|
// production mock server
|
|
|
|
if (import.meta.env.PROD) {
|
|
|
|
import('./mock-prod-server').then(({ setupProdMockServer }) => {
|
|
|
|
setupProdMockServer();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export { bootstrap };
|