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

[Bug report]抖音小程序使用wx:class报错 #1152

Closed
chaping opened this issue Dec 15, 2022 · 4 comments
Closed

[Bug report]抖音小程序使用wx:class报错 #1152

chaping opened this issue Dec 15, 2022 · 4 comments
Labels
processing will provide or fix soon

Comments

@chaping
Copy link

chaping commented Dec 15, 2022

问题描述
抖音小程序模式下,在模板中使用wx:class指令,给它赋值一个对象报错
代码如下:

截图_20221215184819
抖音开发者工具编译报错:
20221215185116
编译警告 [Compile TTML error] Error parsing JavaScript expression: Expecting Unicode escape sequence \uXXXX. (1:30)
at pages/index.ttml (1:115)

环境
mpx版本:v2.8.11
使用的命令:mpx-cli-service serve:mp --targets=tt

思考
貌似是由于编译出来的ttml文件中的反斜杠加双引号引起的错误,如果把反斜杠和双引号去掉换成单引号则正常

@Blackgan3 Blackgan3 added the processing will provide or fix soon label Dec 16, 2022
@Blackgan3
Copy link
Collaborator

是windows系统吗

@chaping
Copy link
Author

chaping commented Dec 16, 2022

是windows系统,但最先是在同事的mac电脑上发现的,我在windows系统上也复现出来了

@Blackgan3
Copy link
Collaborator

我这本地尝试两个版本的cli创建的项目都没有复现你说的这个问题,上传一个复现demo吧

@chaping
Copy link
Author

chaping commented Dec 20, 2022

抱歉,确实不是mpx的问题。
之前在 #860 找到了一个Tailwindcss的解决方案,装了MiniProgramTailwindWebpackPlugin这个插件,发现正是这个插件引起的问题。

没用这个插件时,编译出来的是:
<view class='{{__stringify__.stringifyClass("", {red:red})}}'></view>

用了这个插件时,编译出来的是:
<view class="{{__stringify__.stringifyClass(\"\",{red:red})}}"></view>
然后就会报错了

@chaping chaping closed this as completed Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
processing will provide or fix soon
Projects
None yet
Development

No branches or pull requests

2 participants