From b125d3ea74d61fb8e4d7238c83906aeea52c6b4c Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期二, 12 三月 2024 14:39:55 +0800 Subject: [PATCH] 更新代码 --- pages/bookServices/list/index.js | 32 ++++++++++++++++++++++++++++---- 1 files changed, 28 insertions(+), 4 deletions(-) diff --git a/pages/bookServices/list/index.js b/pages/bookServices/list/index.js index 890c3b9..ccb63b6 100644 --- a/pages/bookServices/list/index.js +++ b/pages/bookServices/list/index.js @@ -9,7 +9,11 @@ searchValue: '', path: '', pathList: [], - page: 1, + pageCount: { + page: 1, + total: 0, + }, + isMore: null, assortCheck: { name: '', code: '', @@ -135,6 +139,24 @@ */ onReachBottom(e) { console.log('搴曢儴'); + const flag = this.data.bookList.length < this.data.pageCount.total + if (flag) { + this.setData({ + isMore: true, + "pageCount.page": this.data.pageCount.page + 1 + }) + this.getBookList(this.data.path) + } else { + this.setData({ + isMore: true, + }) + setTimeout(() => { + this.setData({ + isMore: false + }) + }, 100) + console.log('娌℃湁鏇村浜�'); + } }, /** @@ -299,8 +321,8 @@ height: 145, }, paging: { - start: (this.data.page - 1) * 16, - size: 16, + start: 0, + size: this.data.pageCount.page * 8, }, fields: { author: [], @@ -313,8 +335,10 @@ app.MG.store.getProductList(query).then((res) => { this.setData({ bookList: res.datas, - enable: false + enable: false, + "pageCount.total": res.total }); + console.log('鍥句功鍒楄〃', res, this.data.pageCount); }); }, // 涓�绾у垎绫诲垏鎹� -- Gitblit v1.9.1