修复定位按钮无反应 + 增强高亮效果

- scrollIntoView 改用 requestAnimationFrame 确保 DOM 已更新
- 滚动位置改为 block: 'start',更可靠
- 高亮增加背景色变化(bg-press-wash/40),更明显
- 高亮持续时间延长至 5 秒

Co-Authored-By: new-provider/LongCat-2.0 <<EMAIL>>
)
This commit is contained in:
shangfangjian
2026-09-21 00:48:39 +08:00
parent 83cc24e54b
commit ad184e1b82
+10 -4
View File
@@ -75,9 +75,15 @@ export default function DataCompletenessPage() {
// 点击问题项 → 滚动到对应联赛卡片并高亮
const scrollToLeague = useCallback((code: string) => {
setHighlightedLeague(code)
leagueRefs.current[code]?.scrollIntoView({ behavior: 'smooth', block: 'center' })
// 3秒后移除高亮
setTimeout(() => setHighlightedLeague(null), 3000)
// 使用 requestAnimationFrame 确保 DOM 已更新
requestAnimationFrame(() => {
const el = leagueRefs.current[code]
if (el) {
el.scrollIntoView({ behavior: 'smooth', block: 'start' })
}
})
// 5秒后移除高亮
setTimeout(() => setHighlightedLeague(null), 5000)
}, [])
return (
@@ -167,7 +173,7 @@ export default function DataCompletenessPage() {
<div
key={league.code}
ref={el => { leagueRefs.current[league.code] = el }}
className={`transition-all duration-500 ${isHighlighted ? 'ring-2 ring-press scale-[1.01]' : ''}`}
className={`transition-all duration-500 ${isHighlighted ? 'ring-2 ring-press bg-press-wash/40 scale-[1.01]' : ''}`}
>
<Card>
<CardHeader