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

VirtualList 的 itemSize 只能是 number,能否支持字符串,小程序的 rpx? #7738

Closed
wang777777 opened this issue Sep 25, 2020 · 4 comments · Fixed by #14155
Closed
Labels
A-components Area - H5 组件库相关 A-components-advanced Area - 高阶组件 enhancement New feature or request

Comments

@wang777777
Copy link

这个特性解决了什么问题?

虚拟滚动 itemSize 类型为 number,实际情况是 VirtualList 组件里写的是px,这样就导致不同的设备类型不适配,能否支持写rpx? 或者告知下 itemSize 适配不同设备的方法?

这个 API 长什么样?

itemSize 可以写字符串,支持 rpx

@xyz-fish
Copy link
Contributor

Taro.pxTransform 转换下?

@chenchenpp
Copy link

这个怎么解决的?

@hardywu
Copy link

hardywu commented Nov 25, 2021

压根就别用virtuallist,这个组件没放进导出模块就是因为没写好。

@ZakaryCode ZakaryCode added the A-components Area - H5 组件库相关 label Jan 15, 2022
@ZakaryCode ZakaryCode added the A-components-advanced Area - 高阶组件 label Mar 21, 2023
@ZakaryCode
Copy link
Contributor

虚拟滚动 itemSize 类型为 number,实际情况是 VirtualList 组件里写的是px,这样就导致不同的设备类型不适配,能否支持写rpx?

不太可能支持,如果该参数支持更多单位会导致虚拟列表复杂度上升,且 rpx 一类单位无法在组件内计算相关值,这会导致组件显示出现错误

或者告知下 itemSize 适配不同设备的方法

由于该参数仅对应子节点高度,需要额外适配耗费的情况比较少,同时对于该类情况可以通过 pxTransform 将子节点高度与 itemSize 对齐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-components Area - H5 组件库相关 A-components-advanced Area - 高阶组件 enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants