varlet icon indicating copy to clipboard operation
varlet copied to clipboard

toPxNum 方法不支持 dvh, svh, lvh 等 css 单位,导致 var-list 组件的 offset 无法正常工作

Open lzj97 opened this issue 1 year ago • 1 comments

Bug report 🐞

toPxNum 方法不支持 dvh, svh, lvh 等 css 单位。 导致部分组件无法按预期工作,也不抛出异常,比如 var-list 组件的 offset 属性。

复现示例: https://varletjs.org/playground#demo

在上面的示例中,将 offset 设置为 10dvh 将导致 var-list 不会正常工作。

Version & Environment

Expectation

Actual results (or Errors)

Reproduction link

lzj97 avatar Aug 13 '24 11:08 lzj97

目前我们对这样的相对单位暂时只支持到 vw vh vmin vmax。由于即将成为主流的相对单位越来越多,未来有可能不会支持更多单位,也有可能通过修改单位的转换逻辑(通过动态插入元素让浏览器去得出绘制结果或其他方式)去支持更多的单位。

haoziqaq avatar Aug 13 '24 12:08 haoziqaq