From 1e251ad000652172720ce3b29bfb69c22ff90814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Fri, 9 Jan 2026 11:53:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=94=AE=E7=A9=BA=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=9C=AA=E6=9B=B4=E6=96=B0=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E8=B0=83=E6=95=B4=E8=87=AA=E5=8A=A8=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BB=A5=E6=94=AF=E6=8C=81=E5=94=AE=E7=A9=BA?= =?UTF-8?q?=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index 44bdf45..157446e 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -778,14 +778,17 @@ Page({ lastDataTimestamp: new Date().getTime() }) - // 检查过滤后的非广告商品数量,如果不足6个且当前不是加载更多状态,则自动触发上拉加载更多 + // 检查过滤后的非广告商品数量,如果不足6个,则自动触发上拉加载更多 + // 对于已发布商品,在非加载更多模式下触发;对于售空商品,在加载更多模式下触发 const nonAdGoodsCount = filteredGoods.filter(item => !item.isAd).length; - if (!isLoadMore && nonAdGoodsCount < 6 && !this.data.loadingMore && !this.data.isLoading) { - console.log('非广告商品数量不足6个,自动触发上拉加载更多'); - // 使用setTimeout确保当前任务完成后再触发加载更多 - setTimeout(() => { - this.loadGoods(true); - }, 100); + if (nonAdGoodsCount < 6 && !this.data.loadingMore && !this.data.isLoading) { + if (!isLoadMore || this.data.isQueryingSoldOut) { + console.log('商品数量不足6个,自动触发上拉加载更多'); + // 使用setTimeout确保当前任务完成后再触发加载更多 + setTimeout(() => { + this.loadGoods(true); + }, 100); + } } }, @@ -870,6 +873,7 @@ Page({ }) // 检查过滤后的非广告商品数量,如果不足6个,则自动触发上拉加载更多 + // 对于已发布商品,在非加载更多模式下触发;对于售空商品,在加载更多模式下触发 const nonAdGoodsCount = filteredGoods.filter(item => !item.isAd).length; if (nonAdGoodsCount < 6 && !this.data.loadingMore && !this.data.isLoading) { console.log('刷新后商品数量不足6个,自动触发上拉加载更多');