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

34 lines
727 B
TypeScript
Raw Normal View History

2024-07-30 16:19:17 +00:00
import { createApp } from 'vue';
import { registerAccessDirective } from '@vben/access';
import { initStores } from '@vben/stores';
import '@vben/styles';
import { setupI18n } from '#/locales';
import { initComponentAdapter } from './adapter/component';
2024-07-30 16:19:17 +00:00
import App from './app.vue';
import { router } from './router';
async function bootstrap(namespace: string) {
// 初始化组件适配器
initComponentAdapter();
2024-07-30 16:19:17 +00:00
const app = createApp(App);
// 国际化 i18n 配置
await setupI18n(app);
// 配置 pinia-tore
await initStores(app, { namespace });
// 安装权限指令
registerAccessDirective(app);
// 配置路由及路由守卫
app.use(router);
app.mount('#app');
}
export { bootstrap };