From 6a5a72828f43994404ac4f802b238803e86ce54f Mon Sep 17 00:00:00 2001 From: xudan Date: Thu, 9 Oct 2025 18:14:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=99=A8=E4=B8=AD=E7=9A=84=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E4=B8=8D=E5=BF=85=E8=A6=81=E7=9A=84=E4=B9=90=E8=A7=82?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=8A=B6=E6=80=81=EF=BC=8C=E7=AE=80=E5=8C=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PlaybackController.vue | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/components/PlaybackController.vue b/src/components/PlaybackController.vue index f230f8a..c0590ce 100644 --- a/src/components/PlaybackController.vue +++ b/src/components/PlaybackController.vue @@ -62,24 +62,13 @@ const formatTime = (ms: number): string => { return `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`; }; -const currentTimeFormatted = computed(() => formatTime(pendingSeekTime.value ?? props.currentTime)); +const currentTimeFormatted = computed(() => formatTime(props.currentTime)); const totalDurationFormatted = computed(() => formatTime(props.totalDuration)); -// 本地“乐观显示”的时间:在 seek 后先行展示,待实际时间变更后清空 -const pendingSeekTime = ref(null); - -// 同步清理:当外部 currentTime 改变时,移除乐观显示 -watch( - () => props.currentTime, - () => { - pendingSeekTime.value = null; - }, -); - const playheadPosition = computed(() => { const viewDuration = viewEndTime.value - viewStartTime.value; if (viewDuration <= 0) return '0%'; - const current = pendingSeekTime.value ?? props.currentTime; + const current = props.currentTime; const relativeTime = current - viewStartTime.value; const clamped = Math.min(Math.max(relativeTime, 0), viewDuration); return `${(clamped / viewDuration) * 100}%`; @@ -116,7 +105,6 @@ const handleHourChange = (newHour: number) => { const newTime = newHour * HOUR_IN_MS; // 确保搜寻时间不超过总时长 const clampedTime = Math.min(newTime, props.totalDuration); - pendingSeekTime.value = clampedTime; emit('seek', clampedTime); }; @@ -140,7 +128,6 @@ const handleTimelineClick = (event: MouseEvent) => { const ratio = clampedX / effectiveWidth; const viewDuration = viewEndTime.value - viewStartTime.value; const targetTime = Math.floor(viewStartTime.value + ratio * viewDuration); - pendingSeekTime.value = targetTime; emit('seek', targetTime); // 点击发生后,立即更新所选小时,保持左侧小时选择与视窗一致 const clickedHour = Math.floor(targetTime / HOUR_IN_MS);