const init = async () => {
if (flag.value) {
uni.showToast({
title: '没有更多数据~',
icon: 'none',
})
return
}
const params = {
query: searchValue.value,
limit: limit.value,
page: page.value,
}
const res = await getPhoneInfoAPI(params)
list.value.push(...res.data.data)
console.log('🚀 ~ init ~ list.value:', list.value)
if (list.value.length < res.data.total) {
// 页面累加
page.value++
} else {
flag.value = true
}
}
onReachBottom(() => {
init()
})
onLoad(() => {
init()
})
04-16
867
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)