Skip to content

Commit f04abdb

Browse files
committed
Update TheComment.vue
1 parent 701af49 commit f04abdb

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

web/src/components/advanced/TheComment.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,17 @@ const commentAnchorId = (id: string) => `comment-anchor-${id}`
397397
const highlightedId = ref<string | null>(null)
398398
let highlightTimer: ReturnType<typeof setTimeout> | null = null
399399
400-
const jumpToComment = (id?: string | null) => {
400+
const jumpToComment = async (id?: string | null) => {
401401
if (!id) return
402402
const el = document.getElementById(commentAnchorId(id))
403403
if (!el) return
404404
el.scrollIntoView({ behavior: 'smooth', block: 'center' })
405-
highlightedId.value = id
406405
if (highlightTimer) clearTimeout(highlightTimer)
406+
// 先清空并等 DOM 落地,再赋值,强制 CSS 高亮动画重播——
407+
// 否则连续点同一目标时 highlightedId 值未变,Vue 不重渲染,动画不会重新触发。
408+
highlightedId.value = null
409+
await nextTick()
410+
highlightedId.value = id
407411
highlightTimer = setTimeout(() => {
408412
highlightedId.value = null
409413
highlightTimer = null

0 commit comments

Comments
 (0)