标签:res str 输出 split amp replace detail 连接 text
先将换行符替换成自定义连接字符
var goods_detail = ""
if(res.data.info.goods_info.goods_detail){
goods_detail = res.data.info.goods_info.goods_detail;
var str=goods_detail.replace(/\n/g,"|-&");
var goods_detail1 = str.split("|-&");
if(goods_detail1[0]){
goods_detail1 = goods_detail1;
}else{
goods_detail1[0] = goods_detail
}
}
然后循环输出数组
<view class="productIntro_text">
<view wx:for="{{goods_detail1}}">{{item}}</view>
</view>
标签:res str 输出 split amp replace detail 连接 text
原文地址:http://www.cnblogs.com/lcming/p/7739476.html