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(
@@ -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'))