From cf722f5707381867b4de405bdfaf649ddba28ec9 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 21 Aug 2025 16:30:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E9=A6=96=E9=A1=B5tabs?= =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend_nuxt/pages/index.vue | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/frontend_nuxt/pages/index.vue b/frontend_nuxt/pages/index.vue index d99bff85a..03e840e47 100644 --- a/frontend_nuxt/pages/index.vue +++ b/frontend_nuxt/pages/index.vue @@ -155,17 +155,22 @@ const route = useRoute() const tagOptions = ref([]) const categoryOptions = ref([]) -const topics = ref(['精选', '最新回复', '最新', '排行榜' /*, '热门', '类别'*/]) +const topics = ref(['最新回复', '最新', '精选', '排行榜' /*, '热门', '类别'*/]) const selectedTopicCookie = useCookie('homeTab') -const selectedTopic = ref( - selectedTopicCookie.value - ? selectedTopicCookie.value - : route.query.view === 'ranking' - ? '排行榜' - : route.query.view === 'latest' - ? '最新' - : '最新回复', -) + +let defaultTopic = '最新回复' + +if (selectedTopicCookie.value) { + defaultTopic = selectedTopicCookie.value +} else if (route.query.view === 'ranking') { + defaultTopic = '排行榜' +} else if (route.query.view === 'latest') { + defaultTopic = '最新' +} else if (route.query.view === 'featured') { + defaultTopic = '精选' +} +const selectedTopic = ref(defaultTopic) + if (!selectedTopicCookie.value) selectedTopicCookie.value = selectedTopic.value const articles = ref([]) const page = ref(0)