From 139b76423f67575ed225f784ec45a34d38d46d15 Mon Sep 17 00:00:00 2001 From: qiuchengw Date: Thu, 25 Sep 2025 11:43:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B7=A6=E4=BE=A7list?= =?UTF-8?q?=E5=92=8C=E5=8F=B3=E4=BE=A7=E7=94=98=E7=89=B9=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E5=81=8F=E5=B7=AE=EF=BC=8C=E8=A1=8C=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=AF=B9=E9=BD=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TaskList.vue | 8 +++----- src/components/TaskRow.vue | 3 ++- src/components/Timeline.vue | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/TaskList.vue b/src/components/TaskList.vue index d3ad37c..7a4b55b 100644 --- a/src/components/TaskList.vue +++ b/src/components/TaskList.vue @@ -313,14 +313,12 @@ const handleTaskListScroll = (event: Event) => { detail: { scrollTop }, }), ) -} - -// 处理Timeline垂直滚动同步 +}// 处理Timeline垂直滚动同步 const handleTimelineVerticalScroll = (event: CustomEvent) => { const { scrollTop } = event.detail const taskListBodyElement = document.querySelector('.task-list-body') as HTMLElement - if (taskListBodyElement && taskListBodyElement.scrollTop !== scrollTop) { - // 避免循环触发,只在scrollTop不同时才设置 + if (taskListBodyElement && Math.abs(taskListBodyElement.scrollTop - scrollTop) > 1) { + // 使用更精确的比较,避免1px以内的细微差异导致的循环触发 taskListBodyElement.scrollTop = scrollTop } } diff --git a/src/components/TaskRow.vue b/src/components/TaskRow.vue index 16b80e4..1525a34 100644 --- a/src/components/TaskRow.vue +++ b/src/components/TaskRow.vue @@ -518,7 +518,8 @@ onUnmounted(() => { .task-row { display: flex; border-bottom: 1px solid var(--gantt-border-light); - height: 50px; + height: 51px; /* 修改为51px,与Timeline中的task-row高度保持一致,包含border-bottom 1px */ + box-sizing: border-box; /* 确保border包含在高度计算中 */ background: var(--gantt-bg-primary); align-items: center; color: var(--gantt-text-secondary); diff --git a/src/components/Timeline.vue b/src/components/Timeline.vue index 7dee155..06d88d0 100644 --- a/src/components/Timeline.vue +++ b/src/components/Timeline.vue @@ -1543,8 +1543,8 @@ onMounted(() => { const handleTaskListVerticalScroll = (event: CustomEvent) => { const { scrollTop } = event.detail const timelineBody = document.querySelector('.timeline-body') as HTMLElement - if (timelineBody && timelineBody.scrollTop !== scrollTop) { - // 避免循环触发,只在scrollTop不同时才设置 + if (timelineBody && Math.abs(timelineBody.scrollTop - scrollTop) > 1) { + // 使用更精确的比较,避免1px以内的细微差异导致的循环触发 timelineBody.scrollTop = scrollTop } }