main.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import 'uno.css';
  2. import '/@/design/index.less';
  3. import animate from 'animate.css';
  4. //lxh
  5. import './assets/iconfong/iconfont.css';
  6. import './assets/iconfong/iconfont.js';
  7. // 注册图标
  8. import 'virtual:svg-icons-register';
  9. import App from './App.vue';
  10. import { createApp } from 'vue';
  11. import { getRemoteSetting } from '/@/hooks/setting';
  12. import { initAppConfigStore } from '/@/logics/initAppConfig';
  13. import { setupErrorHandle } from '/@/logics/error-handle';
  14. import { router, setupRouter } from '/@/router';
  15. import { setupRouterGuard } from '/@/router/guard';
  16. import { setupStore } from '/@/store';
  17. import { setupGlobDirectives } from '/@/directives';
  18. import { setupI18n } from '/@/locales/setupI18n';
  19. import { registerGlobComp } from '/@/components/registerGlobComp';
  20. import { registerThirdComp } from '/@/settings/registerThirdComp';
  21. // 注册online模块lib
  22. // import { registerPackages } from '/@/utils/monorepo/registerPackages';
  23. import { initModalWorker, initTHREE } from '/@/utils/threejs/main.worker';
  24. import GlobalConfig from './components/config/GlobalConfig.vue';
  25. // 在本地开发中引入的,以提高浏览器响应速度
  26. if (import.meta.env.DEV) {
  27. // @ts-ignore
  28. import('ant-design-vue/dist/antd.less');
  29. }
  30. await getRemoteSetting();
  31. async function bootstrap() {
  32. // 创建应用实例
  33. const app = createApp(App);
  34. app.use(animate);
  35. // 多语言配置,异步情况:语言文件可以从服务器端获得
  36. await setupI18n(app);
  37. // 配置存储
  38. setupStore(app);
  39. // 初始化内部系统配置
  40. initAppConfigStore();
  41. // 注册外部模块路由(注册online模块lib)
  42. // registerPackages(app);
  43. // 注册全局组件
  44. registerGlobComp(app);
  45. // 配置路由
  46. setupRouter(app);
  47. // 路由保护
  48. setupRouterGuard(router);
  49. // 注册全局指令
  50. setupGlobDirectives(app);
  51. // 配置全局错误处理
  52. setupErrorHandle(app);
  53. // 注册第三方组件
  54. await registerThirdComp(app);
  55. // 当路由准备好时再执行挂载( https://next.router.vuejs.org/api/#isready)
  56. await router.isReady();
  57. initModalWorker();
  58. initTHREE();
  59. app.component('GlobalConfig', GlobalConfig);
  60. app.provide('globalConfig', {
  61. // 你的全局配置
  62. simulatedPassword: VENT_PARAM['simulatedPassword'],
  63. History_Type: History_Type['type'],
  64. pageType: '',
  65. showReport: VENT_PARAM['showReport'],
  66. });
  67. // 挂载应用
  68. app.mount('#app', true);
  69. console.log(' vue3 app 加载完成!');
  70. }
  71. bootstrap();