miniprogram-to-uniapp
miniprogram-to-uniapp copied to clipboard
transformFor方法替换单引号为双引号出错
问题描述?
//transformFor方法中,此行代码将单引号替换为双引号,导致程序转换出来的不正确
vForAttr = vForAttr.replace(/'/g, `"`)
重现步骤
待转换代码:
<block wx:for="{{coupon['store_list']}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<view class="vipgrade">
<text>{{item.store_name}}</text>
</view>
</block>
转换后的代码
<block v-for="(item,index) in (coupon[" store_list"])" :key="index">
<view class="vipgrade"> <text>{{item.store_name}}</text> </view>
</block>
主要错误代码如下(coupon的索引值为双引号)
v-for="(item,index) in (coupon[" store_list"])"
期望的结果
<block v-for="(item,index) in (coupon['store_list'])" :key="index">
<view class="vipgrade"> <text>{{item.store_name}}</text> </view>
</block>
感谢反馈,遇到另一个场景也有此问题,下版本准备注释掉
v2.1.1已解决