From ebc79f36e77ff683b9be8e82f7cb39d3c4cd02d1 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 6 Feb 2026 17:35:59 +0800 Subject: [PATCH] fix: keep browser history for home category and tag filters --- frontend_nuxt/components/ArticleCategory.vue | 2 +- frontend_nuxt/components/ArticleTags.vue | 2 +- frontend_nuxt/components/MenuComponent.vue | 4 ++-- frontend_nuxt/components/SearchDropdown.vue | 4 ++-- frontend_nuxt/pages/users/[id].vue | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend_nuxt/components/ArticleCategory.vue b/frontend_nuxt/components/ArticleCategory.vue index 4e229c80b..6844d84c8 100644 --- a/frontend_nuxt/components/ArticleCategory.vue +++ b/frontend_nuxt/components/ArticleCategory.vue @@ -21,7 +21,7 @@ const props = defineProps({ const gotoCategory = async () => { if (!props.category) return const value = encodeURIComponent(props.category.id ?? props.category.name) - await navigateTo({ path: '/', query: { category: value } }, { replace: true }) + await navigateTo({ path: '/', query: { category: value } }) } const isImageIcon = (icon) => { diff --git a/frontend_nuxt/components/ArticleTags.vue b/frontend_nuxt/components/ArticleTags.vue index 09ef3aad2..7adab1c90 100644 --- a/frontend_nuxt/components/ArticleTags.vue +++ b/frontend_nuxt/components/ArticleTags.vue @@ -30,7 +30,7 @@ defineProps({ const gotoTag = async (tag) => { const value = encodeURIComponent(tag.id ?? tag.name) - await navigateTo({ path: '/', query: { tags: value } }, { replace: true }) + await navigateTo({ path: '/', query: { tags: value } }) } const isImageIcon = (icon) => { diff --git a/frontend_nuxt/components/MenuComponent.vue b/frontend_nuxt/components/MenuComponent.vue index 871eb1675..d173e40b3 100644 --- a/frontend_nuxt/components/MenuComponent.vue +++ b/frontend_nuxt/components/MenuComponent.vue @@ -357,13 +357,13 @@ const isImageIcon = (icon) => { const gotoCategory = (c) => { const value = encodeURIComponent(c.id ?? c.name) - navigateTo({ path: '/', query: { category: value } }, { replace: true }) + navigateTo({ path: '/', query: { category: value } }) handleItemClick() } const gotoTag = (t) => { const value = encodeURIComponent(t.id ?? t.name) - navigateTo({ path: '/', query: { tags: value } }, { replace: true }) + navigateTo({ path: '/', query: { tags: value } }) handleItemClick() } diff --git a/frontend_nuxt/components/SearchDropdown.vue b/frontend_nuxt/components/SearchDropdown.vue index fedbee882..4f87b2dc5 100644 --- a/frontend_nuxt/components/SearchDropdown.vue +++ b/frontend_nuxt/components/SearchDropdown.vue @@ -170,9 +170,9 @@ watch(selected, (val) => { navigateTo(`/posts/${opt.postId}#comment-${opt.id}`, { replace: true }) } } else if (opt.type === 'category') { - navigateTo({ path: '/', query: { category: opt.id } }, { replace: true }) + navigateTo({ path: '/', query: { category: opt.id } }) } else if (opt.type === 'tag') { - navigateTo({ path: '/', query: { tags: opt.id } }, { replace: true }) + navigateTo({ path: '/', query: { tags: opt.id } }) } selected.value = null keyword.value = '' diff --git a/frontend_nuxt/pages/users/[id].vue b/frontend_nuxt/pages/users/[id].vue index a2d99b307..5a482191e 100644 --- a/frontend_nuxt/pages/users/[id].vue +++ b/frontend_nuxt/pages/users/[id].vue @@ -643,7 +643,7 @@ const sendMessage = async () => { const gotoTag = (tag) => { const value = encodeURIComponent(tag.id ?? tag.name) - navigateTo({ path: '/', query: { tags: value } }, { replace: true }) + navigateTo({ path: '/', query: { tags: value } }) } const init = async () => {