Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(picker): fix custom height problem #1576

Merged
merged 9 commits into from
Sep 13, 2024

Conversation

jby0107
Copy link
Collaborator

@jby0107 jby0107 commented Sep 10, 2024

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

fix #1207

💡 需求背景和解决方案

调整--td-picker-item-height后picker滚动参数不正确。发现是初始化滚动参数将itemHeight重置为了默认高度40。另外inidicator的位置写死为80px,应该为2 * --td-picker-item-height。

另外,t-popup使用v-show,在初始化滚动参数时query获取不到元素高度,自定义高度需要加一个v-if:

<t-popup v-if="cityState.show" v-model="cityState.show" placement="bottom">
    <t-picker
      v-model="cityState.city"
      :columns="cityOptions"
      @confirm="onConfirm"
      @cancel="cityState.show = false"
      @pick="onPick"
    />
</t-popup>

针对这种情况添加了demo

📝 更新日志

  • fix(Picker): 修复自定义高度时滚动参数异常

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

deleted unexpected reset of itemHeight in initScrollParams(), changed the positioning of the
indicator to a dynamic value based on --td-picker-item-height; Added a demo of using custom height

fix Tencent#1207
Copy link
Contributor

github-actions bot commented Sep 10, 2024

完成

@liweijie0812
Copy link
Collaborator

/update-common

@anlyyao
Copy link
Collaborator

anlyyao commented Sep 11, 2024

@jby0107 初始化位置定位不准,滚动时激活索引计算错误。 辛苦有空在继续跟进看看~

截屏2024-09-11 12 40 58 截屏2024-09-11 12 41 05

@liweijie0812
Copy link
Collaborator

/update-common

@liweijie0812
Copy link
Collaborator

/update-snapshot

Copy link
Contributor

⏳ 正在运行快照更新。。。 CI: Open

@anlyyao
Copy link
Collaborator

anlyyao commented Sep 13, 2024

/update-common

@anlyyao anlyyao merged commit 2827c67 into Tencent:develop Sep 13, 2024
7 checks passed
@github-actions github-actions bot mentioned this pull request Sep 13, 2024
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.

[picker] 初始化滚动参数,itemHeight写死了40,不能根据样式设置的高度来定义。
3 participants