cb&&cb(); // 等同于 if (cb) { // 判断cb是否有被当成参数传过来,有的话则执行cb函数 cb(); }
onPullDowmRefresh:function(){
this.setData({
page:1,
shopList:[],
total:0
})
this.getshoplist( ()=> {
wx.stopPullDownRefresh()
})
},
onLoad(options) {
this.setData({
query:options
})
this.getshoplist()
},
getshoplist(cb){
this.setData({
})
wx.showLoading({
title:'数据加载中'
})
wx.request({
url:'gsgshsh',
method:'GET',
data:{
page:this.data.page,
limit:this.data.pageSize
},
success:(res)=>{
this.setData({
shopList:[...this.data.shoplist,...res.data],
total:res.header['count']-0
})
},
complete:()=>{
wx.hideLoading()
this.satData({
isloading:false
})
cb && cb()
}
})
}
|