先将换行符替换成自定义连接字符
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>