大致思路
1, 在data中存储可变化的page或limit 方便接口请求
2,在请求接口中使用默认显示的数据
orders() {
uni.getStorage({
key: 'token',
success: (res) => {
console.log(res.data)
uni.request({
url: '',
method: 'GET',
data: {
'limit': this.limit,
'page': this.page,
},
header: {
'Content-Type': 'multipart/form-data',
'authtoken': res.data
},
success: (res) => {
console.log("订单", res.data)
this.order = [...this.order, ...res.data.data.order]
}
})
}
})
},
使用onReachBottom函数使触底page+1
onReachBottom() {
console.log("到底了")
this.page++;
this.orders();
},