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

【taroize】不支持wx:if后面有空白字符(可能其它标签也有这个问题) #4142

Closed
Qiyu8 opened this issue Aug 12, 2019 · 1 comment
Assignees

Comments

@Qiyu8
Copy link
Collaborator

Qiyu8 commented Aug 12, 2019

问题描述
微信小程序wxml写法如下:
<view wx:if= "{{data.test}}"></view>
微信编译器可以过滤掉wx:if后面的空白字符
但是在taro convert的过程中会报错,导致无法转换为taro的标签,出现这种问题一般不好排查,因为页面中类似标签太多了

复现步骤
1.在微信小程序根目录执行 taro convert
2.打开taroconvert目录,执行yarn
3.执行yarn build:weapp
期望行为
微信小程序代码成功taro化
报错信息

wx:if 的值需要用双括号 `{{}}` 包裹它的值
错误  页面转换  pages/goodsDetail/goodsDetail.js
TypeError: Cannot read property 'expression' of null
    at C:\Users\f00381993\AppData\Local\Yarn\Data\global\node_modules\@tarojs\taroize\lib\src\wxml.js:432:61
    at Array.reduceRight (<anonymous>)
    at handleConditions (C:\Users\f00381993\AppData\Local\Yarn\Data\global\node_modules\@tarojs\taroize\lib\src\wxml.js:431:14)
    at transformIf (C:\Users\f00381993\AppData\Local\Yarn\Data\global\node_modules\@tarojs\taroize\lib\src\wxml.js:410:5)
    at jsxAttrVisitor (C:\Users\f00381993\AppData\Local\Yarn\Data\global\node_modules\@tarojs\taroize\lib\src\wxml.js:51:9)
    at NodePath._call (C:\Users\f00381993\AppData\Local\Yarn\Data\global\node_modules\babel-traverse\lib\path\context.js:76:18)
    at NodePath.call (C:\Users\f00381993\AppData\Local\Yarn\Data\global\node_modules\babel-traverse\lib\path\context.js:48:17)
    at NodePath.visit (C:\Users\f00381993\AppData\Local\Yarn\Data\global\node_modules\babel-traverse\lib\path\context.js:105:12)
    at TraversalContext.visitQueue (C:\Users\f00381993\AppData\Local\Yarn\Data\global\node_modules\babel-traverse\lib\context.js:150:16)
    at TraversalContext.visitMultiple (C:\Users\f00381993\AppData\Local\Yarn\Data\global\node_modules\babel-traverse\lib\context.js:103:17)

系统信息
操作系统: Windows 10
Taro 版本 v1.3.12
Node.js 版本 v12.7.0
报错平台 weapp
补充信息
在转换过程中使用空白字符正则过滤之后再进行转换

@taro-bot
Copy link

taro-bot bot commented Aug 12, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

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

2 participants