js代码
basketball_list:{ swiper:[ {img:i0b,text:\'demo-text-1\'}, {img:i1b,text:\'demo-text-1\'} ], data:[ {img:\'url\', title: \'title\', date: \'date\', count: \'count\'}, {img:\'url\', title: \'title\', date: \'date\', count: \'count\'}, ] },
wxml代码
<view class="goods-box" wx:for="{{basketball_list.data}}"> <view>{{item.img}}</view> <view>{{item.title}}</view> <view>{{item.date}}{{item.count}}</view> </view>
<swiper indicator-dots="true" autoplay="false" interval="2000" duration="500"> <block wx:for="{{basketball_list.swiper}}" wx:key="*this"> <swiper-item> <image style="width:100%;height:160px;" src="{{item.img}}"></image> </swiper-item> </block> </swiper>
注意:data定义方式
1:data[]——数组
2:data{}——对象(集合)
请发表评论