| | |
| | | import { createApp, watchEffect } from 'vue'; |
| | | import VueDOMPurifyHTML from 'vue-dompurify-html'; |
| | | |
| | | import { registerAccessDirective } from './packages\effects\access\src'; |
| | | import { registerLoadingDirective } from './packages\effects\common-ui\src\loading'; |
| | | import { preferences } from './packages\preferences\src'; |
| | | import { initStores } from './packages\stores\src'; |
| | | import { registerAccessDirective } from './packages/effects/access/src'; |
| | | import { registerLoadingDirective } from './packages/effects/common-ui/src/components/loading'; |
| | | import { preferences } from './packages/preferences/src'; |
| | | import { initStores } from './packages/stores/src'; |
| | | import './packages/styles/src'; |
| | | import './packages/styles/src/antd'; |
| | | import './packages/styles/src/antd/index.css'; |
| | | |
| | | import { useTitle } from '@vueuse/core'; |
| | | |
| | |
| | | import { initSetupVbenForm } from './adapter/form'; |
| | | import App from './app.vue'; |
| | | import { router } from './router'; |
| | | |
| | | import { getCompanyConfig } from '#/api/system/company-config'; |
| | | import { applyCompanyConfig } from '#/utils/company-config'; |
| | | |
| | | async function bootstrap(namespace: string) { |
| | | // 初始化组件适配器 |
| | |
| | | // 配置 pinia-store |
| | | await initStores(app, { namespace }); |
| | | |
| | | // 加载公司品牌信息(从后端,免登录接口),联动登录页/菜单栏/网页标题。 |
| | | // 注:此时 pinia 尚未在组件外激活,这里用纯函数,不依赖 store。 |
| | | try { |
| | | const companyConfig = await getCompanyConfig(); |
| | | if (companyConfig) { |
| | | applyCompanyConfig(companyConfig); |
| | | } |
| | | } catch { |
| | | // 后端不可用或未配置,保持编译期默认 |
| | | } |
| | | |
| | | // 安装权限指令 |
| | | registerAccessDirective(app); |
| | | |
| | | // 初始化 tippy |
| | | const { initTippy } = await import('./packages\effects\common-ui\src\tippy'); |
| | | const { initTippy } = await import('./packages/effects/common-ui/src/components/tippy'); |
| | | initTippy(app); |
| | | |
| | | // 配置路由及路由守卫 |
| | |
| | | setupFormCreate(app); |
| | | |
| | | // 配置Motion插件 |
| | | const { MotionPlugin } = await import('./packages\effects\plugins\src\motion'); |
| | | const { MotionPlugin } = await import('./packages/effects/plugins/src/motion'); |
| | | app.use(MotionPlugin); |
| | | |
| | | // 动态更新标题 |
| | |
| | | if (preferences.app.dynamicTitle) { |
| | | const routeTitle = router.currentRoute.value.meta?.title; |
| | | const pageTitle = |
| | | (routeTitle ? `${$t(routeTitle)} - ` : '') + preferences.app.name; |
| | | (routeTitle ? `${$t(routeTitle)} - ` : '') + |
| | | preferences.copyright.companyName; |
| | | useTitle(pageTitle); |
| | | } |
| | | }); |