Skip to content

[Bug report] unocss translate-[-50%,-50%] 输出 css 异常 #1953

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

Open
lp0124 opened this issue Apr 11, 2025 · 9 comments
Open

[Bug report] unocss translate-[-50%,-50%] 输出 css 异常 #1953

lp0124 opened this issue Apr 11, 2025 · 9 comments

Comments

@lp0124
Copy link
Contributor

lp0124 commented Apr 11, 2025

通过最新 cli 创建的项目

<view class="list flex translate-[-50%,-50%]">
    <view wx:for="{{listData}}" wx:key="*this">{{item}}</view>
</view>
Image Image
@lp0124
Copy link
Contributor Author

lp0124 commented Apr 11, 2025

正常应该是

Image

@cwyyue
Copy link
Contributor

cwyyue commented Apr 11, 2025

可以换种写法,-translate-x-50%,-translate-y-50%。
unocss有很多内置预设,mpx unocss 默认预设是基于windicss的验证的, windicss的文档外的写法不保证能支持。

@lp0124
Copy link
Contributor Author

lp0124 commented Apr 11, 2025

可以换种写法,-translate-x-50%,-translate-y-50%。 unocss有很多内置预设,mpx unocss 默认预设是基于windicss的验证的, windicss的文档外的写法不保证能支持。

Image Image

可是我看这两种写法都在 wind3 预设里呀

@lp0124
Copy link
Contributor Author

lp0124 commented Apr 11, 2025

现在的问题在于这种写法能被规则匹配到,但是输出的样式不正确,确实是可以换种写法

@cwyyue
Copy link
Contributor

cwyyue commented Apr 11, 2025

可以换种写法,-translate-x-50%,-translate-y-50%。 unocss有很多内置预设,mpx unocss 默认预设是基于windicss的验证的, windicss的文档外的写法不保证能支持。

Image Image
可是我看这两种写法都在 wind3 预设里呀

这个是unocss 的预设文档,可以看windicss的文档https://cn.windicss.org/utilities/animations/transforms.html#transform-translate

@lp0124
Copy link
Contributor Author

lp0124 commented Apr 11, 2025

破案了,mpx 内部使用的 "@unocss/preset-uno": "0.52.7" 这个版本的预设存在这个问题

Image

@lp0124
Copy link
Contributor Author

lp0124 commented Apr 11, 2025

[0.58.7](https://github.com/unocss/unocss/releases/tag/v0.58.7)

0.58.7 修复了这个问题

@lp0124
Copy link
Contributor Author

lp0124 commented Apr 12, 2025

@hiyuki 有计划升级 unocss 版本到 0.59.2 么

@hiyuki
Copy link
Collaborator

hiyuki commented Apr 14, 2025

应该可以,我们近期看一下

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

No branches or pull requests

3 participants