提交滚动加载
This commit is contained in:
1 parent
062b545bd4
commit
4f489574c1
1 file changed
+20
-4
@@ -251,13 +251,15 @@
|
||||
</view>
|
||||
|
||||
<!-- 分页加载 -->
|
||||
<view v-if="!loading && leaveList.length > 0" class="pagination-container">
|
||||
|
||||
|
||||
<view v-if="leaveList.length > 0" class="pagination-container">
|
||||
<u-loadmore
|
||||
:status="loadStatus"
|
||||
@loadmore="loadMore"
|
||||
load-text="点击或上拉加载更多"
|
||||
load-text="上拉加载更多"
|
||||
loading-text="正在加载..."
|
||||
no-more-text="没有更多了"
|
||||
no-more-text="没有更多数据了"
|
||||
/>
|
||||
</view>
|
||||
|
||||
@@ -337,6 +339,12 @@ export default {
|
||||
uni.$off('refreshLeaveList', this.handleRefreshEvent);
|
||||
},
|
||||
|
||||
// 页面滚动到底部事件
|
||||
onReachBottom() {
|
||||
console.log('🔄 触发滚动到底部事件,开始加载更多...');
|
||||
this.loadMore();
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 处理刷新事件
|
||||
handleRefreshEvent() {
|
||||
@@ -452,8 +460,16 @@ export default {
|
||||
|
||||
// 加载更多
|
||||
async loadMore() {
|
||||
if (this.loadStatus !== 'loadmore') return;
|
||||
// 防止重复加载和无效加载
|
||||
if (this.loadStatus !== 'loadmore' || this.loading) {
|
||||
console.log('🚫 跳过加载更多:', {
|
||||
loadStatus: this.loadStatus,
|
||||
loading: this.loading,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('📄 开始加载更多数据...');
|
||||
this.queryParams.pageNum += 1;
|
||||
await this.loadLeaveList(false);
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user