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 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)