<scroll-view @scrolltolower="scrollBottom">
<product-list :goodspage="goodspage"></product-list>
</scroll-view>
scrollBottom() {
console.log('scroll bottom')
if (this.page.current < this.page.pages) {
this.page.current++
this.getProductList()
}
},
async getProductList() {
const res = await this.$api.getProductList(
{
page: {
current: this.page.current,
size: this.page.size,
},
},
)
this.page.total = res.data.total
this.page.pages = res.data.pages
this.page.current = res.data.current
//把返回来的新数据添加到原有数组中
this.goodspage = [...this.goodspage, ...res.data.records]
},
mounted() {
this.getProductList()
},
标签:uniapp,getProductList,请求分页,res,接口,pages,current,data,page
From: https://www.cnblogs.com/tangshidedabenniao/p/17984842