This commit is contained in:
@@ -92,7 +92,7 @@ const data = ref([]);
|
|||||||
|
|
||||||
const page = ref({
|
const page = ref({
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 10,
|
size: 20,
|
||||||
total: 0,
|
total: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -104,16 +104,14 @@ Taro.useDidShow(() => {
|
|||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
|
|
||||||
Taro.useReachBottom(async () => {
|
Taro.useReachBottom(() => {
|
||||||
if (page.value.page * page.value.size >= page.value.total) {
|
if (page.value.total === data.value.length)
|
||||||
Taro.showToast({
|
return Taro.showToast({
|
||||||
title: "没有更多了",
|
title: "没有更多了",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
}
|
|
||||||
page.value.page++;
|
page.value.page++;
|
||||||
await getList();
|
getList();
|
||||||
});
|
});
|
||||||
|
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
@@ -137,7 +135,7 @@ const getList = async () => {
|
|||||||
periods_num: item.PeriodsNum,
|
periods_num: item.PeriodsNum,
|
||||||
})) || [];
|
})) || [];
|
||||||
data.value.push(...arr);
|
data.value.push(...arr);
|
||||||
page.value.total = res.data.total || 0;
|
page.value.total = res.total;
|
||||||
Taro.hideLoading();
|
Taro.hideLoading();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user