admin-vben/apps/web-antd/src/bootstrap.ts

33 lines
698 B
TypeScript
Raw Normal View History

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 '@vben/styles';
import '@vben/styles/antd';
2024-06-01 15:15:29 +00:00
import { preferences } from '@vben-core/preferences';
import { loadMessages, setupI18n } from '#/locales';
2024-06-16 15:40:52 +00:00
import { setupStore } from '#/store';
2024-05-24 15:11:03 +00:00
import App from './app.vue';
import { router } from './router';
async function bootstrap(namespace: string) {
2024-05-24 15:11:03 +00:00
const app = createApp(App);
// 国际化 i18n 配置
await setupI18n(app, {
defaultLocale: preferences.app.locale,
loadMessages,
missingWarn: !import.meta.env.PROD,
});
2024-05-24 15:11:03 +00:00
// 配置 pinia-store
await setupStore(app, { namespace });
2024-05-24 15:11:03 +00:00
// 配置路由及路由守卫
app.use(router);
app.mount('#app');
}
export { bootstrap };