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

暂不支持对 MPX class name 绑定中的对象增强语法进行处理 #36

Open
ItsRyanWu opened this issue Jul 10, 2022 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@ItsRyanWu
Copy link
Contributor

ItsRyanWu commented Jul 10, 2022

MPX 样式类名对象增强语法

简单来说就是类似这样的语法

<!-- 正常使用 -->
<view wx:class="{{ {'text-red-500': true} }}"></view>
<!-- 无法使用 -->
<view wx:class="{{ {'text-[#c0ffee]': true} }}"></view>

如果开发者在 MPX 项目中使用以上 MPX 增强语法来实现动态切换 class name,目前插件不支持对存在特殊字符的类名进行兼容性处理,不过对使用常规字符的 class name 不存在影响。

由于 MPX 对于对象语法是采用 wxs 脚本实现的,我暂未想到合适的方法让插件对该场景下的特殊字符进行处理,目前建议通过其他方式绕过该问题,比如使用小程序原生语法来实现 class name 切换:

<!-- 正常使用 -->
<view class="{{ true ? 'text-[#c0ffee]' : '' }}"></view>
@ItsRyanWu ItsRyanWu changed the title 暂不支持对 MPX class name 绑定中的对象语法进行处理 暂不支持对 MPX class name 绑定中的对象增强语法进行处理 Jul 10, 2022
@ItsRyanWu ItsRyanWu added the help wanted Extra attention is needed label Jul 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant