fix: toggle community category filter

This commit is contained in:
hajimi
2026-08-02 19:57:05 +08:00
parent 2a9416c696
commit 883b3143d5
+4 -3
View File
@@ -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)