From 90cd267391d1f5eb69edebdfe59f315ccaa37f06 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 13 Aug 2026 16:29:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=81=E5=BC=8F=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E9=A6=96=E6=AC=A1=E8=BF=9B=E5=85=A5=E6=9C=AA=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D=E5=88=B0=E4=BB=8A=E5=A4=A9=EF=BC=9A=E7=AD=89=E5=BE=85?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=8A=A0=E8=BD=BD=E5=AE=8C=E6=88=90=E5=90=8E?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/calendar/CalendarStream.vue | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/frontend/ops_vue_js/src/views/calendar/CalendarStream.vue b/frontend/ops_vue_js/src/views/calendar/CalendarStream.vue index 0f8fe33..891a852 100644 --- a/frontend/ops_vue_js/src/views/calendar/CalendarStream.vue +++ b/frontend/ops_vue_js/src/views/calendar/CalendarStream.vue @@ -807,16 +807,18 @@ function goToToday() { generateInitialWeeks() lastEventsSnapshot = null const { start, end } = getLoadedRange() - fetchEvents(start, end).then(() => { - nextTick(() => { - const todayStr = dateToStr(new Date()) - const container = scrollContainerRef.value - if (!container) return - const todayCell = container.querySelector(`.day-cell[data-date="${todayStr}"]`) - if (todayCell) { - todayCell.scrollIntoView({ block: 'center', behavior: 'smooth' }) - } - }) + fetchEvents(start, end).then(() => scrollToToday()) +} + +function scrollToToday() { + nextTick(() => { + const todayStr = dateToStr(new Date()) + const container = scrollContainerRef.value + if (!container) return + const todayCell = container.querySelector(`.day-cell[data-date="${todayStr}"]`) + if (todayCell) { + todayCell.scrollIntoView({ block: 'center' }) + } }) } @@ -868,18 +870,9 @@ onMounted(() => { generateInitialWeeks() const { start, end } = getLoadedRange() - fetchEvents(start, end) + fetchEvents(start, end).then(() => scrollToToday()) nextTick(() => { - const todayStr = dateToStr(new Date()) - const container = scrollContainerRef.value - if (container) { - const todayCell = container.querySelector(`.day-cell[data-date="${todayStr}"]`) - if (todayCell) { - todayCell.scrollIntoView({ block: 'center' }) - } - } - if (topSentinelRef.value && bottomSentinelRef.value && scrollContainerRef.value) { intersectionObserver = new IntersectionObserver((entries) => { for (const entry of entries) {