小程序轮播图显示三个数据
//专家团队
getZhuanjia: function () {
var that = this;
app.util.request({
"url": "entry/wxapp/YuZhuanjia",
success: function (res) {
var big = res.data.data;
var length = big.length;
var num = parseInt(length / 3);
var arr = [];
for (var i = 0; i < num; i++) {
var ar = [];
for (var j = 0; j < 3; j++) {
ar.push(big[j])
}
arr.push(ar)
}
if (length % 3 != 0) {
var ar = []
for (var k = (num * 3); k < length; k++) {
ar.push(big[k])
}
arr.push(ar)
}
that.setData({
expert: arr
})
// WxParse.wxParse('jianjie', 'html', res.data.data.z_jianjie, that, 5);
}
})
},
<view class='bsbb p30 bgcf'>
<swiper class='h500' current='{{current}}' bindchange='nav'>
<block wx:for="{{expert}}" wx:key="unique" wx:for-item="items">
<swiper-item class="bsbb pt30 pb30">
<view class='df'>
<block wx:for="{{items}}" wx:key="unique">
<view class='df fdc aic jcc mr30' data-z_id="{{item.z_id}}" bindtap='doctorDetailClick'>
<view class='pr'>
<view>
<image mode='widthFix' style='width:210rpx;' src='../images/doctor_bg.png'></image>
</view>
<view class='pa doctor-img w df aife jcfe'>
<image mode='widthFix' src='{{item.z_thumbs}}'></image>
</view>
</view>
<view class='fs32 c6 mt20'>{{item.z_name}}</view>
<view class='fs24 c6 fw3 mt10'>{{item.z_zhicheng}}</view>
<view>
<button class='bdn bdc_sec c_sec fs24 fw3 h40 mt10'>详细了解</button>
</view>
</view>
</block>
</view>
</swiper-item>
</block>
</swiper>
<view class='df aic jcc'>
<block wx:for="{{expert}}" wx:key="unique">
<view class='cir mr20 bdr50 {{current == index ? "bgc_sec":"bgceb"}}'></view>
</block>
</view>
</view>