diff --git a/src/views/topic/aside/components/AsideActive.vue b/src/views/topic/aside/components/AsideActive.vue
index 26f9d18d..75be8d47 100644
--- a/src/views/topic/aside/components/AsideActive.vue
+++ b/src/views/topic/aside/components/AsideActive.vue
@@ -9,7 +9,8 @@ import KUNGalgameFooter from '@/components/KUNGalgameFooter.vue'
import { useTempReplyStore } from '@/store/temp/topic/reply'
import { storeToRefs } from 'pinia'
-import { asideItem } from './asideItem'
+import { asideItem, sortItem } from './asideItem'
+import type { SortField, SortOrder } from './asideItem'
const { replyRequest } = storeToRefs(useTempReplyStore())
@@ -19,19 +20,14 @@ const props = defineProps<{
}>()
const { tags, uid } = toRefs(props)
-const handleSortReply = (sortField: string) => {
+const handleSortReply = (sortField: SortField) => {
useTempReplyStore().resetPageStatus()
replyRequest.value.sortField = sortField
}
-const orderAscending = () => {
+const handleClickSortOrder = (sortOrder: SortOrder) => {
useTempReplyStore().resetPageStatus()
- replyRequest.value.sortOrder = 'asc'
-}
-
-const orderDescending = () => {
- useTempReplyStore().resetPageStatus()
- replyRequest.value.sortOrder = 'desc'
+ replyRequest.value.sortOrder = sortOrder
}
@@ -44,6 +40,9 @@ const orderDescending = () => {
@@ -102,11 +105,6 @@ const orderDescending = () => {
justify-content: center;
align-items: center;
}
-
- &:hover {
- transition: all 0.2s;
- background-color: var(--kungalgame-trans-blue-2);
- }
}
.order {
@@ -121,13 +119,18 @@ const orderDescending = () => {
display: flex;
justify-content: center;
align-items: center;
-
- &:hover {
- transition: all 0.2s;
- background-color: var(--kungalgame-blue-4);
- color: var(--kungalgame-white);
- }
}
}
}
+
+.item-active {
+ transition: all 0.2s;
+ background-color: var(--kungalgame-trans-blue-2);
+}
+
+.order-active {
+ transition: all 0.2s;
+ background-color: var(--kungalgame-blue-4);
+ color: var(--kungalgame-white);
+}
diff --git a/src/views/topic/aside/components/AsideBase.vue b/src/views/topic/aside/components/AsideBase.vue
index c8fa1a09..6091f3a6 100644
--- a/src/views/topic/aside/components/AsideBase.vue
+++ b/src/views/topic/aside/components/AsideBase.vue
@@ -4,23 +4,19 @@ import { Icon } from '@iconify/vue'
import { useTempReplyStore } from '@/store/temp/topic/reply'
import { storeToRefs } from 'pinia'
-import { asideItem } from './asideItem'
+import { asideItem, sortItem } from './asideItem'
+import type { SortField, SortOrder } from './asideItem'
const { isScrollToTop, replyRequest } = storeToRefs(useTempReplyStore())
-const handleSortReply = (sortField: string) => {
+const handleSortReply = (sortField: SortField) => {
useTempReplyStore().resetPageStatus()
replyRequest.value.sortField = sortField
}
-const orderAscending = () => {
+const handleClickSortOrder = (sortOrder: SortOrder) => {
useTempReplyStore().resetPageStatus()
- replyRequest.value.sortOrder = 'asc'
-}
-
-const orderDescending = () => {
- useTempReplyStore().resetPageStatus()
- replyRequest.value.sortOrder = 'desc'
+ replyRequest.value.sortOrder = sortOrder
}
const handleBackToTop = () => {
@@ -41,12 +37,16 @@ const handleBackToTop = () => {
>
-
-
-
-
-
+
+
+
+
diff --git a/src/views/topic/aside/components/asideItem.ts b/src/views/topic/aside/components/asideItem.ts
index f39fb070..69ef63aa 100644
--- a/src/views/topic/aside/components/asideItem.ts
+++ b/src/views/topic/aside/components/asideItem.ts
@@ -1,6 +1,9 @@
+export type SortField = 'floor' | 'likes_count' | 'comments_count'
+export type SortOrder = 'asc' | 'desc'
+
interface Item {
index: number
- sortField: string
+ sortField: SortField
icon: string
name: string
}
@@ -25,3 +28,22 @@ export const asideItem: Item[] = [
name: 'comment',
},
]
+
+interface SortItem {
+ index: number
+ sortOrder: SortOrder
+ icon: string
+}
+
+export const sortItem: SortItem[] = [
+ {
+ index: 1,
+ sortOrder: 'asc',
+ icon: 'tdesign:order-ascending',
+ },
+ {
+ index: 2,
+ sortOrder: 'desc',
+ icon: 'tdesign:order-descending',
+ },
+]