修复点击今天定位失效:修正增量方向并处理月份分隔条偏移;版本号升至1.5.7
This commit is contained in:
2 files changed
+10
-5
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ops_vue_js",
|
||||
"version": "1.5.6",
|
||||
"version": "1.5.7",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"engines": {
|
||||
|
||||
@@ -853,16 +853,21 @@ function applyTodayScroll() {
|
||||
if (!todayCell) return
|
||||
|
||||
const idx = weeks.value.findIndex(w => weekKey(w) === dateToStr(getWeekStart(new Date())))
|
||||
const prevWeekHeight = idx > 0
|
||||
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
|
||||
}
|
||||
|
||||
const contRect = container.getBoundingClientRect()
|
||||
const cellRect = todayCell.getBoundingClientRect()
|
||||
const currentTop = cellRect.top - contRect.top
|
||||
const desiredTop = prevWeekHeight
|
||||
|
||||
container.scrollTop += (desiredTop - currentTop)
|
||||
container.scrollTop += (currentTop - desiredTop)
|
||||
}
|
||||
|
||||
function applyScrollToTitle(titleEl) {
|
||||
@@ -1240,7 +1245,7 @@ watch(locale, () => {
|
||||
<!-- Month Separator -->
|
||||
<div
|
||||
v-if="shouldShowMonthSeparator(i)"
|
||||
class="sticky top-0 z-[5] py-1 px-4 text-base font-medium text-gray-500 bg-gray-100 border-b border-gray-200 dark:bg-dk-base dark:text-gray-400 dark:border-dk-muted"
|
||||
class="month-separator sticky top-0 z-[5] py-1 px-4 text-base font-medium text-gray-500 bg-gray-100 border-b border-gray-200 dark:bg-dk-base dark:text-gray-400 dark:border-dk-muted"
|
||||
>
|
||||
{{ getMonthLabel(week) }}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user