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

32 lines
639 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-07-30 13:10:28 +00:00
import { registerAccessDirective } from '@vben/access';
import { initStores } from '@vben/stores';
2024-06-08 11:49:06 +00:00
import '@vben/styles';
import '@vben/styles/antd';
2024-06-01 15:15:29 +00:00
import { setupI18n } from '#/locales';
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);
2024-05-24 15:11:03 +00:00
// 配置 pinia-tore
2024-07-30 13:10:28 +00:00
await initStores(app, { namespace });
2024-05-24 15:11:03 +00:00
// 安装权限指令
2024-07-30 13:10:28 +00:00
registerAccessDirective(app);
2024-05-24 15:11:03 +00:00
// 配置路由及路由守卫
app.use(router);
app.mount('#app');
}
export { bootstrap };