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)