文章為博主原創,純屬個人見解,如有錯誤歡迎指出。
如需轉載,請注明出處。
在js中遍歷
for (var index in res.data.infos) { res.data.infos[index].info_file = res.data.infos[index].info_file.split(','); }
在wxml中遍歷
<view class="img" wx:for="{{item.info_file}}" wx:for-item="img" wx:key="img" id="img" bindtap='previewImg' id="img" data-imgs='{{item.info_file}}' data-currentimg="{{img}}"> <image src="{{server_host}}{{img}}"></image> </view>