From 883b3143d50a4ec3de631efcfa4f866e40e4e3aa Mon Sep 17 00:00:00 2001 From: hajimi Date: Sun, 2 Aug 2026 19:57:05 +0800 Subject: [PATCH] fix: toggle community category filter --- uniapp/src/pages/community/community.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/uniapp/src/pages/community/community.vue b/uniapp/src/pages/community/community.vue index 66fb254..42f9cfa 100644 --- a/uniapp/src/pages/community/community.vue +++ b/uniapp/src/pages/community/community.vue @@ -255,9 +255,10 @@ const switchFeed = (feed: FeedKey) => { } const selectCategory = (category: any) => { - activeCategoryId.value = category.id - if (activeFeed.value === 'topic') { - uni.setStorageSync(COMMUNITY_ACTIVE_CATEGORY_KEY, category.id) + const categoryId = Number(category.id) || 0 + activeCategoryId.value = activeCategoryId.value === categoryId ? 0 : categoryId + if (activeFeed.value === 'topic' && activeCategoryId.value > 0) { + uni.setStorageSync(COMMUNITY_ACTIVE_CATEGORY_KEY, activeCategoryId.value) uni.removeStorageSync(LEGACY_COMMUNITY_ACTIVE_TAG_KEY) } else { uni.removeStorageSync(COMMUNITY_ACTIVE_CATEGORY_KEY)