分页组件添加功能计算未加载的项的数目,click查看捐款记录跳转到捐款列表页面

This commit is contained in:
WindowBird 2025-08-29 16:29:27 +08:00
parent a79bd2c500
commit 13d2323190
2 changed files with 19 additions and 9 deletions

View File

@ -36,6 +36,7 @@ export function createPagination(options = {}) {
currentPage: 1,
pageSize,
totalPages: 0,
remainingItems: 0,
},
// 上拉加载相关
@ -94,6 +95,10 @@ export function createPagination(options = {}) {
currentPage: this.winB_QueryParams.pageNum,
pageSize,
totalPages: Math.ceil(total / pageSize),
remainingItems: Math.max(
0,
total - this.winB_QueryParams.pageNum * pageSize,
),
};
// 检查是否还有更多数据

View File

@ -38,7 +38,7 @@
</view>
</view>
</view>
<view class="record"
<view class="record" @click="goDonationRecord"
>查看捐款记录
<u-icon name="arrow-right"></u-icon>
</view>
@ -71,7 +71,7 @@
</view>
</view>
<view v-if="winB_NoMore === false" class="more" @click="loadMore"
>查看更多{{ remainingItems }}条进展
>查看更多{{ winB_Pagination.remainingItems }}条进展
</view>
<view v-else class="more">到底了</view>
</view>
@ -243,13 +243,18 @@ export default {
loadMore() {
this.winB_LoadMore();
},
goDonationRecord() {
// ID
uni.navigateTo({
url: `/pages/institutionalStructure/donationRecord?formedId=${this.formedId}`,
fail: (err) => {
console.error("跳转失败:", err);
uni.showToast({
title: "页面跳转失败",
icon: "none",
});
},
computed: {
remainingItems() {
return (
this.winB_Pagination.total -
this.winB_Pagination.currentPage * this.winB_Pagination.pageSize
);
});
},
},
};