From 84fcab0ae69db4fb45fab4ea8dbe91865b448418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E4=B8=81?= Date: Tue, 19 May 2026 14:56:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9Atab=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E4=BA=8B=E4=BB=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 5 ++--- src/views/Home.vue | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/App.vue b/src/App.vue index 712eb89..85ab498 100644 --- a/src/App.vue +++ b/src/App.vue @@ -180,7 +180,7 @@ watch(
+ @click="menuStore.onCategorySelect(0, item.id)"> {{ item.label }}
@@ -470,11 +470,10 @@ watch( display: flex; padding-left: 8px; flex: 1; - cursor: default; + cursor: pointer; .app-tab-bar-item { padding: 0 8px; - } .app-tab-bar-item-active { diff --git a/src/views/Home.vue b/src/views/Home.vue index 9a5417d..41749ea 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -126,6 +126,9 @@ const menuStore = useMenuStore() const { categoryTree, layerActiveValues, categoryLayers } = storeToRefs(menuStore) const { filterVisible } = menuStore +/** 标记是否为分类初始化阶段,用于 watch 时区分初始加载与用户切换 */ +const isCategoryInitializing = ref(false) + function doSearch(keyword: string) { @@ -257,7 +260,9 @@ async function loadCategory() { if (USE_MOCK_CATEGORY) { categoryTree.value = enrichWithIcons(MOCK_CATEGORY_TREE) + isCategoryInitializing.value = true initCategorySelection() + isCategoryInitializing.value = false loadEventListAfterCategoryReady() } else { try { @@ -272,7 +277,9 @@ async function loadCategory() { } catch { categoryTree.value = enrichWithIcons(MOCK_CATEGORY_TREE) } + isCategoryInitializing.value = true initCategorySelection() + isCategoryInitializing.value = false loadEventListAfterCategoryReady() } } @@ -287,6 +294,18 @@ watch( }, ) +// 监听 categoryLayers 和 layerActiveValues 变化,自动刷新事件列表 +watch( + [categoryLayers, layerActiveValues], + () => { + if (isCategoryInitializing.value) return + clearEventListCache() + eventPage.value = 1 + loadEvents(1, false, activeSearchKeyword.value) + }, + { deep: true }, +) + function onOrderSuccess() { tradeDialogOpen.value = false toastStore.show(t('toast.orderSuccess'))