首先需要再page.json中开启下拉刷新:
同样实现下拉刷新需要触发生命周期函数:onPullDownRefresh()
// 下拉刷新的事件
onPullDownRefresh() {
// 1. 重置关键数据
this.queryObj.pagenum = 1
this.total = 0
this.isloading = false
this.goodsList = []
// 2. 重新发起请求
this.getGoodsList(() => uni.stopPullDownRefresh())
}