【微信小程序】--小程序中循环遍历(包括js中遍历和wxml中的遍历)


文章为博主原创,纯属个人见解,如有错误欢迎指出。

如需转载,请注明出处。


在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>

 

posted @ 2017-10-27 09:47  年轻的老魏  阅读(48683)  评论(0编辑  收藏  举报