From eacc2040a1a3ef1c28af5293a163289e7ec1958a Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 15 Dec 2023 15:37:19 +0900 Subject: [PATCH] perf(frontend): introduce MkLazy for lazy loading --- .../frontend/src/components/global/MkLazy.vue | 53 +++++++++++++++++++ packages/frontend/src/components/index.ts | 3 ++ packages/frontend/src/pages/user/home.vue | 12 +++-- 3 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 packages/frontend/src/components/global/MkLazy.vue diff --git a/packages/frontend/src/components/global/MkLazy.vue b/packages/frontend/src/components/global/MkLazy.vue new file mode 100644 index 0000000000..6d7ff4ca49 --- /dev/null +++ b/packages/frontend/src/components/global/MkLazy.vue @@ -0,0 +1,53 @@ + + + + + + + diff --git a/packages/frontend/src/components/index.ts b/packages/frontend/src/components/index.ts index c740d181f9..a3e13c3a50 100644 --- a/packages/frontend/src/components/index.ts +++ b/packages/frontend/src/components/index.ts @@ -25,6 +25,7 @@ import MkPageHeader from './global/MkPageHeader.vue'; import MkSpacer from './global/MkSpacer.vue'; import MkFooterSpacer from './global/MkFooterSpacer.vue'; import MkStickyContainer from './global/MkStickyContainer.vue'; +import MkLazy from './global/MkLazy.vue'; export default function(app: App) { for (const [key, value] of Object.entries(components)) { @@ -53,6 +54,7 @@ export const components = { MkSpacer: MkSpacer, MkFooterSpacer: MkFooterSpacer, MkStickyContainer: MkStickyContainer, + MkLazy: MkLazy, }; declare module '@vue/runtime-core' { @@ -77,5 +79,6 @@ declare module '@vue/runtime-core' { MkSpacer: typeof MkSpacer; MkFooterSpacer: typeof MkFooterSpacer; MkStickyContainer: typeof MkStickyContainer; + MkLazy: typeof MkLazy; } } diff --git a/packages/frontend/src/pages/user/home.vue b/packages/frontend/src/pages/user/home.vue index ecc3bb36c1..a0163bfc68 100644 --- a/packages/frontend/src/pages/user/home.vue +++ b/packages/frontend/src/pages/user/home.vue @@ -128,12 +128,18 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts.userPagePinTip }}
{{ i18n.ts.featured }}
- + + +