Skip to content

Commit aacb539

Browse files
authored
fix(calendar-item): 修复容器高度小于选择器高度时,位置计算错误问题
viewHeight.value 为容器高度,当容器恰好比当前选中月份高度低时,会导致 `viewPosition < state.monthsData[current].cssScrollHeight + state.monthsData[current].cssHeight` 始终为 true 。从而导致滚动位置偏差一个月。
1 parent 032c54d commit aacb539

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/packages/__VUE/calendaritem/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ export default create({
778778
current -= 1
779779
}
780780
} else {
781-
const viewPosition = Math.round(currentScrollTop + viewHeight.value)
781+
const viewPosition = Math.round(currentScrollTop + Math.max(viewHeight.value, state.monthsData[current].cssHeight)) 
782782
if (
783783
viewPosition < state.monthsData[current].cssScrollHeight + state.monthsData[current].cssHeight
784784
&& currentScrollTop > state.monthsData[current - 1].cssScrollHeight

0 commit comments

Comments
 (0)