data:{
currentSwiper: 0,
recom_list: [{
avatar: 'https://sucai.suoluomei.cn/sucai_zs/images/20191121093322-1.png',
name: '小禾',
college: '圣迪斯哥美容博士',
praise: '666',
advisory: '999'
},
{
avatar: 'https://sucai.suoluomei.cn/sucai_zs/images/20191121093322-1.png',
name: '小禾',
college: '圣迪斯哥美容博士',
praise: '666',
advisory: '999'
},
{
avatar: 'https://sucai.suoluomei.cn/sucai_zs/images/20191121093322-1.png',
name: '小禾',
college: '圣迪斯哥美容博士',
praise: '666',
advisory: '999'
},
{
avatar: 'https://sucai.suoluomei.cn/sucai_zs/images/20191121093322-1.png',
name: '小禾',
college: '圣迪斯哥美容博士',
praise: '666',
advisory: '999'
},
{
avatar: 'https://sucai.suoluomei.cn/sucai_zs/images/20191121093322-1.png',
name: '小禾',
college: '圣迪斯哥美容博士',
praise: '666',
advisory: '999'
}
],
}
//切割数组
onLoad(){
this.getrecom()
}
getrecom() {
var result = []
for (var i = 0; i < this.data.recom_list.length; i += 2) {
result.push(this.data.recom_list.slice(i, i + 2));
}
this.setData({
recom_list: result
})
console.log(this.data.recom_list)
},
// 通过下标改变指示点
swiperChange: function (e) {
this.setData({
currentSwiper: e.detail.current
})
},
如果对你有用,关注一下博主的小程序,登录一下给予支持,以后有什么开源好用的源码都会上传到小程序