onReachBottom: function () {
let that = this
that.setData({//页面触底后 显示隐藏的加载图片
touch:true
})
//动画加载实例
let option = {
duration: 3000,
timingFunction: 'linear'
}
let lanimation = wx.createAnimation(option)
lanimation.rotate(180*10).step()
that.setData({
rotate: lanimation.export()
});
setTimeout(function(){
if(that.data.shopCase.length%6 !== 0){//判断当前加载的数据是否小于6
that.setData({
rotate: lanimation.export(),
touch2:true,
touch:false
})
}else{
let dataSide = that.data.dataSide
dataSide.offset+=1
request.request('api','POST',dataSide).then(res => {//封装的request
that.hideShop()
let oshopCase = that.data.shopCase
let oshopCase2 = oshopCase.concat(res.data)
that.setData({
shopCase: oshopCase2,
rotate: lanimation.export(),
touch:false
})
})
}
},500)
},
网友评论