diff --git a/src/utils/formatTime.ts b/src/utils/formatTime.ts index b1054135..9e00515c 100644 --- a/src/utils/formatTime.ts +++ b/src/utils/formatTime.ts @@ -42,6 +42,7 @@ function replaceTimeUnits(input: string, language: string) { (languageOptions as Record)[language] || languageOptions.en const replacements: Record = { + an: '1', // 将 "an" 替换为 "1" a: '1', // 将 "a" 替换为 "1" second: languageOption.second, seconds: languageOption.seconds, diff --git a/src/views/Home/content/article/components/header/SortTopic.vue b/src/views/Home/content/article/components/header/SortTopic.vue index 3bbbdcb1..3a8bfe8a 100644 --- a/src/views/Home/content/article/components/header/SortTopic.vue +++ b/src/views/Home/content/article/components/header/SortTopic.vue @@ -6,6 +6,10 @@ import { storeToRefs } from 'pinia' // 导入排序列表的字段 import { navSortItem } from './navSortItem' +import { ref } from 'vue' + +// 升序和降序的样式 +const ascClass = ref('') const { sortField, sortOrder } = storeToRefs(useKUNGalgameHomeStore()) @@ -17,18 +21,37 @@ const handleSortByField = (field: string) => { const orderAscending = () => { useKUNGalgameHomeStore().resetPageStatus() sortOrder.value = 'asc' + // 更改样式 + ascClass.value = 'active' } const orderDescending = () => { useKUNGalgameHomeStore().resetPageStatus() sortOrder.value = 'desc' + ascClass.value = '' +} + +const iconMap: Record = { + updated: 'bi:sort-down', + time: 'eos-icons:hourglass', + popularity: 'bi:fire', + views: 'ic:outline-remove-red-eye', + likes: 'line-md:thumbs-up-twotone', + replies: 'ri:reply-line', + comments: 'fa-regular:comment-dots', +} + +const isSortField = () => { + return Object.keys(iconMap).includes(sortField.value) }