Lazy load layout secondary widgets

This commit is contained in:
2026-06-09 14:57:45 +08:00
parent a5b4492f8f
commit 80cc79659a
2 changed files with 22 additions and 2 deletions
+10 -2
View File
@@ -16,9 +16,8 @@ import {
} from 'vue'; } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { AuthenticationLoginExpiredModal } from '@vben/common-ui';
import { useWatermark } from '@vben/hooks'; import { useWatermark } from '@vben/hooks';
import { BasicLayout, LockScreen, UserDropdown } from '@vben/layouts'; import { BasicLayout } from '@vben/layouts';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { preferences } from '@vben/preferences'; import { preferences } from '@vben/preferences';
import { useAccessStore, useUserStore } from '@vben/stores'; import { useAccessStore, useUserStore } from '@vben/stores';
@@ -29,6 +28,15 @@ import { useAuthStore } from '#/store';
const LoginForm = defineAsyncComponent( const LoginForm = defineAsyncComponent(
() => import('#/views/_core/authentication/login.vue'), () => 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( const NotificationPopup = defineAsyncComponent(
() => import('#/components/notification/NotificationPopup.vue'), () => import('#/components/notification/NotificationPopup.vue'),
); );
+12
View File
@@ -113,6 +113,10 @@ export default defineConfig(async () => {
'@vben/common-ui/es/api-component', '@vben/common-ui/es/api-component',
'../../packages/effects/common-ui/src/components/api-component/index.ts', '../../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( exactAlias(
'@vben/constants', '@vben/constants',
'../../packages/constants/src/index.ts', '../../packages/constants/src/index.ts',
@@ -130,6 +134,14 @@ export default defineConfig(async () => {
'@vben/layouts/preferences-blocks', '@vben/layouts/preferences-blocks',
'../../packages/effects/layouts/src/widgets/preferences/blocks/index.ts', '../../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/locales', '../../packages/locales/src/index.ts'),
exactAlias( exactAlias(
'@vben/preferences', '@vben/preferences',