Browse Source

修复潜在bug:移除无限递归风险,优化pageSize设置

Default User 2 months ago
parent
commit
ba79676424
  1. 13
      pages/goods/index.js

13
pages/goods/index.js

@ -28,7 +28,7 @@ Page({
isLoading: false,
isRefreshing: false, // 下拉刷新状态
currentPage: 1,
pageSize: 100,
pageSize: 20,
hasMore: true,
searchKeyword: '',
activeFilter: 'all', // 当前筛选条件:all, small, large
@ -290,17 +290,6 @@ Page({
hasMore: hasMore,
total: total
})
// 如果是第一页,且筛选后的数据不足,尝试加载下一页
if (this.data.currentPage === 1 && hasMore && filteredList.length < this.data.pageSize) {
console.log('筛选后数据不足,继续加载下一页')
this.setData({
currentPage: this.data.currentPage + 1
})
// 递归调用loadGoodsList,继续加载下一页
this.loadGoodsList()
return
}
} else {
console.log('没有产品数据返回')
this.setData({

Loading…
Cancel
Save