Skip to content

Commit

Permalink
fix: onChange loadDada #1
Browse files Browse the repository at this point in the history
  • Loading branch information
sendya committed Oct 25, 2018
1 parent 46c5d7f commit 62f8f10
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/components/table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
},
props: Object.assign({}, T.props, {
rowKey: {
type: String,
type: [String, Function],
default: 'id'
},
data: {
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit 62f8f10

Please sign in to comment.