From 80cc79659af8491d401e95d0b8575def14fe3415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cls=5F=E5=AE=81=E6=B3=A2=E6=9C=AC=E6=9C=BA?= <908705107@qq.com> Date: Tue, 9 Jun 2026 14:57:45 +0800 Subject: [PATCH] Lazy load layout secondary widgets --- web/apps/web-ele/src/layouts/basic.vue | 12 ++++++++++-- web/apps/web-ele/vite.config.mts | 12 ++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/web/apps/web-ele/src/layouts/basic.vue b/web/apps/web-ele/src/layouts/basic.vue index 372583c..4b37680 100644 --- a/web/apps/web-ele/src/layouts/basic.vue +++ b/web/apps/web-ele/src/layouts/basic.vue @@ -16,9 +16,8 @@ import { } from 'vue'; import { useRouter } from 'vue-router'; -import { AuthenticationLoginExpiredModal } from '@vben/common-ui'; import { useWatermark } from '@vben/hooks'; -import { BasicLayout, LockScreen, UserDropdown } from '@vben/layouts'; +import { BasicLayout } from '@vben/layouts'; import { $t } from '@vben/locales'; import { preferences } from '@vben/preferences'; import { useAccessStore, useUserStore } from '@vben/stores'; @@ -29,6 +28,15 @@ import { useAuthStore } from '#/store'; const LoginForm = defineAsyncComponent( () => import('#/views/_core/authentication/login.vue'), ); +const AuthenticationLoginExpiredModal = defineAsyncComponent(() => + import('@vben/common-ui/es/login-expired-modal'), +); +const UserDropdown = defineAsyncComponent(() => + import('@vben/layouts/es/user-dropdown').then((module) => module.UserDropdown), +); +const LockScreen = defineAsyncComponent(() => + import('@vben/layouts/es/lock-screen').then((module) => module.LockScreen), +); const NotificationPopup = defineAsyncComponent( () => import('#/components/notification/NotificationPopup.vue'), ); diff --git a/web/apps/web-ele/vite.config.mts b/web/apps/web-ele/vite.config.mts index c56a50a..2d2ad40 100644 --- a/web/apps/web-ele/vite.config.mts +++ b/web/apps/web-ele/vite.config.mts @@ -113,6 +113,10 @@ export default defineConfig(async () => { '@vben/common-ui/es/api-component', '../../packages/effects/common-ui/src/components/api-component/index.ts', ), + exactAlias( + '@vben/common-ui/es/login-expired-modal', + '../../packages/effects/common-ui/src/ui/authentication/login-expired-modal.vue', + ), exactAlias( '@vben/constants', '../../packages/constants/src/index.ts', @@ -130,6 +134,14 @@ export default defineConfig(async () => { '@vben/layouts/preferences-blocks', '../../packages/effects/layouts/src/widgets/preferences/blocks/index.ts', ), + exactAlias( + '@vben/layouts/es/lock-screen', + '../../packages/effects/layouts/src/widgets/lock-screen/index.ts', + ), + exactAlias( + '@vben/layouts/es/user-dropdown', + '../../packages/effects/layouts/src/widgets/user-dropdown/index.ts', + ), exactAlias('@vben/locales', '../../packages/locales/src/index.ts'), exactAlias( '@vben/preferences',