sonofmagic / weapp-tailwindcss

weapp-tailwindcss - bring tailwindcss to weapp ! 把 tailwindcss 原子化思想带入小程序开发吧 ! weapp-vite 把现代化的开发模式带入小程序开发
https://weapp-tw.icebreaker.top
MIT License
1.2k stars 87 forks source link

mpx编译wxml属性值单引号 #241

Closed forzgc closed 11 months ago

forzgc commented 11 months ago

描述这个Bug A clear and concise description of what the bug is.

mpx框架,编译出来的wxml中某些属性的值可能使用单引号,但是最新版本(>=2.8.0)的weapp-tailwindcss会将单引号包裹的属性值改成双引号包裹,如果属性值内部有使用双引号,则会造成错误

代码

mpx编译后的wxml

<view style='{{__stringify__.stringifyStyle("", ({ color: disabled ? "#bbbbbb" : color }))}}'></view>

weapp-tailwindcss 处理后的wxml

<view style="{{__stringify__.stringifyStyle("", ({ color: disabled ? "#bbbbbb" : color }))}}"></view>

此时由于属性值内部也有双引号,导致属性值格式不正确,开发工具就会报错

如何重现 Steps to reproduce the behavior:

使用 mpx wx:style 属性 或者 事件内联传参 可以复现

期望行为(可选) A clear and concise description of what you expected to happen.

屏幕截图(可选) If applicable, add screenshots to help explain your problem.

运行环境

sonofmagic commented 11 months ago

好的,我修复一下,当时没有考虑到 mpx 的绑定属性是单引号这一点

sonofmagic commented 11 months ago

已经在 2.9.2 版本中修复这个问题。

forzgc commented 11 months ago

好的,感谢