From 9b54fffb5627d48ab51c0c8f0f8ca39685b76025 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 13 Aug 2026 17:32:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=82=B9=E5=87=BB=E4=BB=8A?= =?UTF-8?q?=E5=A4=A9=E5=AE=9A=E4=BD=8D=E5=A4=B1=E6=95=88=EF=BC=9A=E6=94=B9?= =?UTF-8?q?=E7=94=A8scrollIntoView=E5=AE=9A=E4=BD=8D=E4=B8=8A=E5=91=A8?= =?UTF-8?q?=E8=A1=8C=E5=AE=9E=E7=8E=B0=E7=AC=AC=E4=BA=8C=E8=A1=8C=E5=B8=83?= =?UTF-8?q?=E5=B1=80=EF=BC=9B=E7=89=88=E6=9C=AC=E5=8F=B7=E5=8D=87=E8=87=B3?= =?UTF-8?q?1.5.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/ops_vue_js/package.json | 2 +- .../src/views/calendar/CalendarStream.vue | 23 +++++++------------ 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/frontend/ops_vue_js/package.json b/frontend/ops_vue_js/package.json index cb74f9a..169a818 100644 --- a/frontend/ops_vue_js/package.json +++ b/frontend/ops_vue_js/package.json @@ -1,6 +1,6 @@ { "name": "ops_vue_js", - "version": "1.5.7", + "version": "1.5.8", "private": true, "type": "module", "engines": { diff --git a/frontend/ops_vue_js/src/views/calendar/CalendarStream.vue b/frontend/ops_vue_js/src/views/calendar/CalendarStream.vue index 66a54be..cdf22b1 100644 --- a/frontend/ops_vue_js/src/views/calendar/CalendarStream.vue +++ b/frontend/ops_vue_js/src/views/calendar/CalendarStream.vue @@ -812,7 +812,6 @@ function handleDragEnd() { function goToToday() { generateInitialWeeks() lastEventsSnapshot = null - if (scrollContainerRef.value) scrollContainerRef.value.scrollTop = 0 const { start, end } = getLoadedRange() fetchEvents(start, end).then(() => scrollToToday()) } @@ -852,22 +851,16 @@ function applyTodayScroll() { const todayCell = container.querySelector(`.day-cell[data-date="${todayStr}"]`) if (!todayCell) return - const idx = weeks.value.findIndex(w => weekKey(w) === dateToStr(getWeekStart(new Date()))) - let desiredTop = idx > 0 - ? (weekLayouts.get(weekKey(weeks.value[idx - 1]))?.weekHeight ?? 90) - : 0 - const todayWeekEl = todayCell.closest('.week-row') - const prevSib = todayWeekEl?.previousElementSibling - if (prevSib?.classList.contains('month-separator')) { - desiredTop += prevSib.getBoundingClientRect().height + let targetEl = todayWeekEl?.previousElementSibling + if (targetEl && !targetEl.classList.contains('week-row')) { + targetEl = targetEl.previousElementSibling + } + if (targetEl && targetEl.classList.contains('week-row')) { + targetEl.scrollIntoView({ block: 'start' }) + } else { + todayCell.scrollIntoView({ block: 'start' }) } - - const contRect = container.getBoundingClientRect() - const cellRect = todayCell.getBoundingClientRect() - const currentTop = cellRect.top - contRect.top - - container.scrollTop += (currentTop - desiredTop) } function applyScrollToTitle(titleEl) {