Skip to content

Conversation

@vace
Copy link

@vace vace commented Jan 19, 2026

viewHeight.value 为容器高度,当容器恰好比当前选中月份高度低时,会导致 viewPosition < state.monthsData[current].cssScrollHeight + state.monthsData[current].cssHeight 始终为 true 。从而导致滚动位置偏差一个月。

这个 PR 做了什么? (简要描述所做更改)
修复当 calendar-item 容器高度比当前选中月份高度低时,无法正确定位到选中项的问题。
iShot_2026-01-19_17 01 12

这个 PR 是什么类型? (至少选择一个)

  • feat: 新特性提交
  • fix: bug 修复
  • docs: 文档改进
  • style: 组件样式/交互改进
  • type: 类型定义更新
  • perf: 性能、包体积优化
  • refactor: 代码重构、代码风格优化
  • test: 测试用例
  • chore(deps): 依赖升级
  • chore(demo): 演示代码改进
  • chore(locale): 国际化改进
  • chore: 其他改动(是关于什么的改动?)

这个 PR 涉及以下平台:

  • NutUI H5 @nutui/nutui
  • NutUI Taro @nutui/nutui-taro

这个 PR 是否已自测:

viewHeight.value 为容器高度,当容器恰好比当前选中月份高度低时,会导致 `viewPosition < state.monthsData[current].cssScrollHeight + state.monthsData[current].cssHeight` 始终为 true 。从而导致滚动位置偏差一个月。
Copilot AI review requested due to automatic review settings January 19, 2026 09:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 viewPosition calculation 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant