bootstrap.ts 727 B

123456789101112131415161718192021222324252627282930313233
  1. import { createApp } from 'vue';
  2. import { registerAccessDirective } from '@vben/access';
  3. import { initStores } from '@vben/stores';
  4. import '@vben/styles';
  5. import { setupI18n } from '#/locales';
  6. import { initComponentAdapter } from './adapter/component';
  7. import App from './app.vue';
  8. import { router } from './router';
  9. async function bootstrap(namespace: string) {
  10. // 初始化组件适配器
  11. initComponentAdapter();
  12. const app = createApp(App);
  13. // 国际化 i18n 配置
  14. await setupI18n(app);
  15. // 配置 pinia-tore
  16. await initStores(app, { namespace });
  17. // 安装权限指令
  18. registerAccessDirective(app);
  19. // 配置路由及路由守卫
  20. app.use(router);
  21. app.mount('#app');
  22. }
  23. export { bootstrap };