wxml
<swiper-item wx:for="{{banneritem}}">
<image src="{{bannerurl}}"></image>
</swiper-item>
javascript
if (res.data.code == 0) {
// console.log(res);
for(let i =0;i< res.data.messge.length ; i++){
urlImg += res.data.messge[i].For_img;
}
_this.setData({
banneritem : res.data.messge.length,
})
console.log(urlImg);
}
代码如上,我有4个数据,的确是遍历出来了4个内容,但图片全部是一样的,全部是第一张,微信小程序好像没有[i++]这个,我查了网上方法都是用item,但都没看懂,请指点