From 1fa072790f93cfb1b82de07843a0e23d2d7c5541 Mon Sep 17 00:00:00 2001 From: PKC278 <52959804+PKC278@users.noreply.github.com> Date: Thu, 15 Jan 2026 10:45:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/cards/TorrentCard.vue | 2 +- src/components/filter/TorrentFilterBar.vue | 29 +++++++++++++++++----- src/pages/resource.vue | 1 - 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/components/cards/TorrentCard.vue b/src/components/cards/TorrentCard.vue index e4cba49a..239ba86c 100644 --- a/src/components/cards/TorrentCard.vue +++ b/src/components/cards/TorrentCard.vue @@ -136,7 +136,7 @@ onMounted(() => { -
+
{{ media?.title ?? meta?.name }} diff --git a/src/components/filter/TorrentFilterBar.vue b/src/components/filter/TorrentFilterBar.vue index 9b37a20f..7735c8cd 100644 --- a/src/components/filter/TorrentFilterBar.vue +++ b/src/components/filter/TorrentFilterBar.vue @@ -174,14 +174,31 @@ onMounted(() => { const el = filterBarRef.value if (el && el.clientWidth > 0 && el.scrollWidth > el.clientWidth) { // 检查当前视口范围内的最后一个元素(即右侧边缘处的元素) + const containerRect = el.getBoundingClientRect() const children = Array.from(el.children) as HTMLElement[] - const lastInViewport = children.filter(c => (c as HTMLElement).offsetLeft < el.clientWidth).pop() as HTMLElement - if (lastInViewport) { - const visibleWidth = el.clientWidth - lastInViewport.offsetLeft - const visibleRatio = visibleWidth / lastInViewport.offsetWidth + const lastInViewport = children + .filter(c => { + const rect = c.getBoundingClientRect() + return rect.left < containerRect.right + }) + .pop() - // 如果视口内最后一个元素显示比例超过30%,则不需要滚动提示 - if (visibleRatio > 0.3) { + if (lastInViewport) { + const rect = lastInViewport.getBoundingClientRect() + const visibleWidth = Math.min(rect.right, containerRect.right) - rect.left + const visibleRatio = visibleWidth / rect.width + + // 判断是否是列表最后一个元素 + const isLastItem = lastInViewport === children[children.length - 1] + + // 1. 如果是最后一个元素,且显示比例超过80%,说明基本已经展示完了,不需要动画 + if (isLastItem && visibleRatio > 0.8) { + return + } + + // 2. 如果视口内最后一个元素显示比例在30%到80%之间(明显的截断状态),用户能感知到后面还有内容,不需要滚动提示 + // 比例过小(<0.3)可能看不清,非最后一个元素且比例过大(>0.8)可能误以为是结尾,这两种情况都需要提示 + if (visibleRatio > 0.3 && visibleRatio < 0.8) { return } } diff --git a/src/pages/resource.vue b/src/pages/resource.vue index 566af602..08983eeb 100644 --- a/src/pages/resource.vue +++ b/src/pages/resource.vue @@ -640,7 +640,6 @@ onUnmounted(() => { :icon="isRecommending ? 'line-md:loading-twotone-loop' : 'mdi-refresh'" size="18" class="ai-refresh-icon" - :class="{ 'text-primary': isRecommending }" /> {{ t('resource.reRecommend') }}