fix(calendar-item): 修复容器高度小于选择器高度时,位置计算错误问题#3307
Open
vace wants to merge 1 commit intojd-opensource:v4from
Open
fix(calendar-item): 修复容器高度小于选择器高度时,位置计算错误问题#3307vace wants to merge 1 commit intojd-opensource:v4from
vace wants to merge 1 commit intojd-opensource:v4from
Conversation
viewHeight.value 为容器高度,当容器恰好比当前选中月份高度低时,会导致 `viewPosition < state.monthsData[current].cssScrollHeight + state.monthsData[current].cssHeight` 始终为 true 。从而导致滚动位置偏差一个月。
There was a problem hiding this comment.
Pull request overview
This pull request fixes a positioning bug in the calendar-item component that occurs when the container height is smaller than the selected month's height. The issue caused incorrect scroll position calculations, resulting in the calendar being offset by one month.
Changes:
- Modified the
viewPositioncalculation in the scroll handler to use the maximum of container height and month height, preventing incorrect positioning when the viewport is constrained
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
viewHeight.value 为容器高度,当容器恰好比当前选中月份高度低时,会导致
viewPosition < state.monthsData[current].cssScrollHeight + state.monthsData[current].cssHeight始终为 true 。从而导致滚动位置偏差一个月。这个 PR 做了什么? (简要描述所做更改)

修复当 calendar-item 容器高度比当前选中月份高度低时,无法正确定位到选中项的问题。
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台:
这个 PR 是否已自测: