fix: 优化首页tabs排序

This commit is contained in:
Tim
2025-08-21 16:30:54 +08:00
parent 67e54c5106
commit cf722f5707

View File

@@ -155,17 +155,22 @@ const route = useRoute()
const tagOptions = ref([]) const tagOptions = ref([])
const categoryOptions = ref([]) const categoryOptions = ref([])
const topics = ref(['精选', '最新回复', '最新', '排行榜' /*, '热门', '类别'*/]) const topics = ref(['最新回复', '最新', '精选', '排行榜' /*, '热门', '类别'*/])
const selectedTopicCookie = useCookie('homeTab') const selectedTopicCookie = useCookie('homeTab')
const selectedTopic = ref(
selectedTopicCookie.value let defaultTopic = '最新回复'
? selectedTopicCookie.value
: route.query.view === 'ranking' if (selectedTopicCookie.value) {
? '排行榜' defaultTopic = selectedTopicCookie.value
: route.query.view === 'latest' } 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 if (!selectedTopicCookie.value) selectedTopicCookie.value = selectedTopic.value
const articles = ref([]) const articles = ref([])
const page = ref(0) const page = ref(0)