main.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import 'uno.css';
  2. import '/@/design/index.less';
  3. import 'ant-design-vue/dist/reset.css';
  4. // 注册图标
  5. import 'virtual:svg-icons-register';
  6. import App from './App.vue';
  7. import { createApp } from 'vue';
  8. import { initAppConfigStore } from '/@/logics/initAppConfig';
  9. import { setupErrorHandle } from '/@/logics/error-handle';
  10. import { router, setupRouter } from '/@/router';
  11. import { setupRouterGuard } from '/@/router/guard';
  12. import { setupStore } from '/@/store';
  13. import { setupGlobDirectives } from '/@/directives';
  14. import { setupI18n } from '/@/locales/setupI18n';
  15. import { registerGlobComp } from '/@/components/registerGlobComp';
  16. import { registerThirdComp } from '/@/settings/registerThirdComp';
  17. import { useSso } from '/@/hooks/web/useSso';
  18. // 注册online模块lib
  19. import { registerPackages } from '/@/utils/monorepo/registerPackages';
  20. async function bootstrap() {
  21. // 创建应用实例
  22. const app = createApp(App);
  23. // 【QQYUN-6329】
  24. window.appRootInstance = app;
  25. // 多语言配置,异步情况:语言文件可以从服务器端获得
  26. await setupI18n(app);
  27. // 配置存储
  28. setupStore(app);
  29. // 初始化内部系统配置
  30. initAppConfigStore();
  31. // 注册外部模块路由(注册online模块lib)
  32. registerPackages(app);
  33. // 注册全局组件
  34. registerGlobComp(app);
  35. //CAS单点登录
  36. await useSso().ssoLogin();
  37. // 配置路由
  38. setupRouter(app);
  39. // 路由保护
  40. setupRouterGuard(router);
  41. // 注册全局指令
  42. setupGlobDirectives(app);
  43. // 配置全局错误处理
  44. setupErrorHandle(app);
  45. // 注册第三方组件
  46. await registerThirdComp(app);
  47. // 当路由准备好时再执行挂载( https://next.router.vuejs.org/api/#isready)
  48. await router.isReady();
  49. // 挂载应用
  50. app.mount('#app', true);
  51. console.log(" vue3 app 加载完成!")
  52. }
  53. bootstrap();