Drop-down update the data:
Scenario: refresh the list data.
- Configuration "enablePullDownRefresh" in the file or page corresponding app.json JSON file: true;
//下拉更新数据
onPullDownRefresh(){
let _this = this;
_this.getShopOrderList(_this.page);
setTimeout(()=>{
wx.stopPullDownRefresh();
})
},
methods: {
getShopOrderList:function(page){
let _this = this;
_this.$API
.getShopDeliveryList({
page:page,
pageSize:_this.pageSize
})
.then(res => {
_this.orderList = res.billList;
})
.catch(res => {});
}
}
Can () is triggered by the drop-down refresh wx.startPullDownRefresh, user manual pull-down effect and refresh the same.
On Raja upload more:
Scenario: page load data.
- Set "onReachBottomDistance" in app.json file or page corresponding JSON file: 50 Trigger distance;
//上拉加载下一页
onReachBottom(){
let _this = this;
//判断到是最后一页,则停止刷新
if((1+_this.page) > _this.totalPage){
_this.tip('没有更多了!');
return false;
}
_this.getShopOrderList(1+_this.page);
_this.page = 1+_this.page;
},
methods: {
getShopOrderList:function(page){
let _this = this;
_this.$API
.getShopDeliveryList({
page:page,
pageSize:_this.pageSize
})
.then(res => {
_this.orderList = _this.orderList.concat(res.billList);
_this.totalPage = Math.ceil(res.total/res.pageSize);
})
.catch(res => {});
}
}