From b74d34cebf36d2c9fe5598baa9cf767a80024278 Mon Sep 17 00:00:00 2001 From: jiangx <1457960500@qq.com> Date: Mon, 27 Mar 2023 17:11:52 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E2=99=BB=EF=B8=8F=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9worker=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/worker/page.worker.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/static/worker/page.worker.js b/public/static/worker/page.worker.js index 82ca623..0fb8d20 100644 --- a/public/static/worker/page.worker.js +++ b/public/static/worker/page.worker.js @@ -1,4 +1,3 @@ -const MAX_LENGTH = 20 let pageIndex = 1 //数组中需要分页(即下标为pageIdx的数据)的当前页 大数组中的二维 const pageSize = 20 //一页显示的条数 let pageList = [] //用于UI渲染的列表 @@ -62,7 +61,7 @@ function loadMore(_pageIndex) { pageList = [] //找出数据中店铺列表长度大于分页点的索引 从索引处开始分页 - pageIdx = allList.findIndex(item => item.shopList.length > MAX_LENGTH) + pageIdx = allList.findIndex(item => item.shopList.length > pageSize) //pageIdx小于0的话 说明没有店铺列表长度大于分页点的 无需分页直接返回数据 if (pageIdx < 0) {