From 62f8f10afcb09d296a0778b5449530cea518e960 Mon Sep 17 00:00:00 2001 From: Sendya <18x@loacg.com> Date: Thu, 25 Oct 2018 22:27:50 +0800 Subject: [PATCH] fix: onChange loadDada #1 --- src/components/table/index.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/table/index.js b/src/components/table/index.js index 17cc0d8823..86f60530fe 100644 --- a/src/components/table/index.js +++ b/src/components/table/index.js @@ -15,7 +15,7 @@ export default { }, props: Object.assign({}, T.props, { rowKey: { - type: String, + type: [String, Function], default: 'id' }, data: { @@ -83,6 +83,23 @@ export default { this.loadData(); }, loadData(pagination, filters, sorter) { + + /* region + * 由于 Pagination 修改分页下拉选项触发了 showSizeChange 和 change 事件 , + * 而 a-table 中将 showSizeChange 转为 change 事件 , 导致 change 事件重复触发了 2 次 , + * 此处临时处理 , 待作者修复后移除 */ + let _paramStr = JSON.stringify({ + pagination, + filters, + sorter + }) + if (this._lastChangeParamStr === _paramStr && (Date.now() - this._lastChangeTimestamp) < 10) { + return + } + this._lastChangeParamStr = _paramStr; + this._lastChangeTimestamp = Date.now(); + /* regionend */ + this.localLoading = true var result = this.data( Object.assign({