diff --git a/uniapp/src/pages/community/community.vue b/uniapp/src/pages/community/community.vue index 67bc673..66fb254 100644 --- a/uniapp/src/pages/community/community.vue +++ b/uniapp/src/pages/community/community.vue @@ -246,16 +246,23 @@ const switchFeed = (feed: FeedKey) => { }) return } - if (activeFeed.value === feed && (feed !== 'topic' || activeCategoryId.value === 0)) return + if (activeFeed.value === feed && activeCategoryId.value === 0) return activeFeed.value = feed - if (feed !== 'topic') activeCategoryId.value = 0 + activeCategoryId.value = 0 + uni.removeStorageSync(COMMUNITY_ACTIVE_CATEGORY_KEY) + uni.removeStorageSync(LEGACY_COMMUNITY_ACTIVE_TAG_KEY) fetchPosts(true) } const selectCategory = (category: any) => { - activeFeed.value = 'topic' activeCategoryId.value = category.id - uni.setStorageSync(COMMUNITY_ACTIVE_CATEGORY_KEY, category.id) + if (activeFeed.value === 'topic') { + uni.setStorageSync(COMMUNITY_ACTIVE_CATEGORY_KEY, category.id) + uni.removeStorageSync(LEGACY_COMMUNITY_ACTIVE_TAG_KEY) + } else { + uni.removeStorageSync(COMMUNITY_ACTIVE_CATEGORY_KEY) + uni.removeStorageSync(LEGACY_COMMUNITY_ACTIVE_TAG_KEY) + } fetchPosts(true) }