From 744f949972d53e18ef238f788db2c9890e5dd324 Mon Sep 17 00:00:00 2001 From: ccbikai Date: Sun, 16 Mar 2025 13:57:29 +0800 Subject: [PATCH] fix: corrects sorting order and enhances link sorting UX - Fixes ascending/descending sort order for newest/oldest links - Automatically sets sort to 'newest' when creating a link - Updates Chinese translation for A-Z/Z-A sort labels - Shows current sort option in dropdown button - Reduces tooltip delay for better responsiveness - Removes unused Button import in QRCode component --- components/dashboard/links/Index.vue | 5 +++-- components/dashboard/links/QRCode.vue | 1 - components/dashboard/links/Sort.vue | 4 ++-- i18n/locales/zh-CN.json | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/dashboard/links/Index.vue b/components/dashboard/links/Index.vue index 9a72ae3..849e9e4 100644 --- a/components/dashboard/links/Index.vue +++ b/components/dashboard/links/Index.vue @@ -14,9 +14,9 @@ const displayedLinks = computed(() => { const sorted = [...links.value] switch (sortBy.value) { case 'newest': - return sorted.sort((a, b) => a.createdAt - b.createdAt) - case 'oldest': return sorted.sort((a, b) => b.createdAt - a.createdAt) + case 'oldest': + return sorted.sort((a, b) => a.createdAt - b.createdAt) case 'az': return sorted.sort((a, b) => a.slug.localeCompare(b.slug)) case 'za': @@ -68,6 +68,7 @@ function updateLinkList(link, type) { } else { links.value.unshift(link) + sortBy.value = 'newest' } } diff --git a/components/dashboard/links/QRCode.vue b/components/dashboard/links/QRCode.vue index d445ecc..7f788d5 100644 --- a/components/dashboard/links/QRCode.vue +++ b/components/dashboard/links/QRCode.vue @@ -1,5 +1,4 @@