From b962cc2f07d3912171a39051ec9f0d4c004d4a4d Mon Sep 17 00:00:00 2001 From: CI010 Date: Sun, 24 Nov 2024 19:57:09 +0800 Subject: [PATCH] refactor: Reduce memroy footprint by using virtual list for modpack upstream display --- .../StoreProjectInstallVersionDialog.vue | 71 +++---- .../src/directives/sharedTooltip.ts | 2 +- xmcl-keystone-ui/src/util/el.ts | 5 + .../src/views/AppSideBarContentFocus.vue | 33 +++ xmcl-keystone-ui/src/views/HomeDefault.vue | 5 +- xmcl-keystone-ui/src/views/HomeFocus.vue | 78 +++---- .../src/views/HomeFocusFooter.vue | 103 +++++----- xmcl-keystone-ui/src/views/HomeLayout.vue | 2 + .../src/views/HomeUpstreamBase.vue | 194 +++++++++++++++--- .../src/views/HomeUpstreamCurseforge.vue | 2 +- .../src/views/HomeUpstreamFeedTheBeast.vue | 2 +- .../src/views/HomeUpstreamModrinth.vue | 4 +- .../src/views/HomeUpstreamVersion.vue | 1 - 13 files changed, 315 insertions(+), 187 deletions(-) create mode 100644 xmcl-keystone-ui/src/util/el.ts diff --git a/xmcl-keystone-ui/src/components/StoreProjectInstallVersionDialog.vue b/xmcl-keystone-ui/src/components/StoreProjectInstallVersionDialog.vue index 229d54df3..97264b2a6 100644 --- a/xmcl-keystone-ui/src/components/StoreProjectInstallVersionDialog.vue +++ b/xmcl-keystone-ui/src/components/StoreProjectInstallVersionDialog.vue @@ -163,9 +163,9 @@ diff --git a/xmcl-keystone-ui/src/directives/sharedTooltip.ts b/xmcl-keystone-ui/src/directives/sharedTooltip.ts index 4421e29a2..b78f0293c 100644 --- a/xmcl-keystone-ui/src/directives/sharedTooltip.ts +++ b/xmcl-keystone-ui/src/directives/sharedTooltip.ts @@ -2,7 +2,7 @@ import { SharedTooltipData, useSharedTooltipData } from '@/composables/sharedToo import { FunctionDirective } from 'vue' export type VSharedTooltipParam = { - text: string + text?: string items?: Array<{ icon: string; text: string }> color?: string list?: Array diff --git a/xmcl-keystone-ui/src/util/el.ts b/xmcl-keystone-ui/src/util/el.ts new file mode 100644 index 000000000..752aeb7ce --- /dev/null +++ b/xmcl-keystone-ui/src/util/el.ts @@ -0,0 +1,5 @@ +export function getEl(e: any) { + if (!e) return undefined + if ('$el' in e) return e.$el as HTMLElement + return e as HTMLElement +} diff --git a/xmcl-keystone-ui/src/views/AppSideBarContentFocus.vue b/xmcl-keystone-ui/src/views/AppSideBarContentFocus.vue index ffa91d535..469675bea 100644 --- a/xmcl-keystone-ui/src/views/AppSideBarContentFocus.vue +++ b/xmcl-keystone-ui/src/views/AppSideBarContentFocus.vue @@ -20,6 +20,23 @@ + + + + + {{ upstreamBtn[0] }} + + + + + diff --git a/xmcl-keystone-ui/src/views/HomeDefault.vue b/xmcl-keystone-ui/src/views/HomeDefault.vue index d2e1e645f..4c4002df8 100644 --- a/xmcl-keystone-ui/src/views/HomeDefault.vue +++ b/xmcl-keystone-ui/src/views/HomeDefault.vue @@ -1,5 +1,6 @@