提交 dc339e06 编写于 作者: d-u-a's avatar d-u-a

update: unicloud-db 组件 load事件支持 pagination

上级 4f8e5408
......@@ -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)
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册