From dc339e06736c98760f1e4fcb1a4197c651a3ce93 Mon Sep 17 00:00:00 2001 From: handongxun Date: Mon, 15 Mar 2021 12:00:18 +0800 Subject: [PATCH] =?UTF-8?q?update:=20unicloud-db=20=E7=BB=84=E4=BB=B6=20lo?= =?UTF-8?q?ad=E4=BA=8B=E4=BB=B6=E6=94=AF=E6=8C=81=20pagination?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../uni-cli-shared/components/unicloud-db.vue | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/uni-cli-shared/components/unicloud-db.vue b/packages/uni-cli-shared/components/unicloud-db.vue index 70481f435..e5135b614 100644 --- a/packages/uni-cli-shared/components/unicloud-db.vue +++ b/packages/uni-cli-shared/components/unicloud-db.vue @@ -250,9 +250,14 @@ export default { this._execLoadData(callback, clear) }, loadMore () { - if (this._isEnded) { + if (this._isEnded || this.loading) { return } + + if (this.pageData === pageMode.add) { + this.paginationInternal.current++ + } + this._execLoadData() }, refresh () { @@ -402,7 +407,11 @@ export default { const data2 = this.getone ? (data.length ? data[0] : undefined) : data - callback && callback(data2, this._isEnded) + if (this.getcount) { + this.paginationInternal.count = count + } + + callback && callback(data2, this._isEnded, this.paginationInternal) this._dispatchEvent(events.load, data2) if (this.getone || this.pageData === pageMode.replace) { @@ -413,13 +422,6 @@ export default { } else { this.dataList.push(...data2) } - if (this.dataList.length) { - this.paginationInternal.current++ - } - } - - if (this.getcount) { - this.paginationInternal.count = count } // #ifdef H5 @@ -557,9 +559,9 @@ export default { }, _dispatchEvent (type, data) { if (this._changeDataFunction) { - this._changeDataFunction(data, this._isEnded) + this._changeDataFunction(data, this._isEnded, this.paginationInternal) } else { - this.$emit(type, data, this._isEnded) + this.$emit(type, data, this._isEnded, this.paginationInternal) } } } -- GitLab