Table: change argument selection to cloned array in selection-change event (#9551)

pull/9566/head
FuryBean 2018-01-30 20:13:35 +08:00 committed by 杨奕
parent 88af318e39
commit b27f340561
1 changed files with 5 additions and 5 deletions

View File

@ -289,7 +289,7 @@ TableStore.prototype.mutations = {
if (changed) { if (changed) {
const table = this.table; const table = this.table;
table.$emit('selection-change', selection); table.$emit('selection-change', selection ? selection.slice() : []);
table.$emit('select', selection, row); table.$emit('select', selection, row);
} }
@ -317,7 +317,7 @@ TableStore.prototype.mutations = {
const table = this.table; const table = this.table;
if (selectionChanged) { if (selectionChanged) {
table.$emit('selection-change', selection); table.$emit('selection-change', selection ? selection.slice() : []);
} }
table.$emit('select-all', selection); table.$emit('select-all', selection);
states.isAllSelected = value; states.isAllSelected = value;
@ -372,7 +372,7 @@ TableStore.prototype.clearSelection = function() {
const oldSelection = states.selection; const oldSelection = states.selection;
states.selection = []; states.selection = [];
if (oldSelection.length > 0) { if (oldSelection.length > 0) {
this.table.$emit('selection-change', states.selection); this.table.$emit('selection-change', states.selection ? states.selection.slice() : []);
} }
}; };
@ -395,7 +395,7 @@ TableStore.prototype.setExpandRowKeys = function(rowKeys) {
TableStore.prototype.toggleRowSelection = function(row, selected) { TableStore.prototype.toggleRowSelection = function(row, selected) {
const changed = toggleRowSelection(this.states, row, selected); const changed = toggleRowSelection(this.states, row, selected);
if (changed) { if (changed) {
this.table.$emit('selection-change', this.states.selection); this.table.$emit('selection-change', this.states.selection ? this.states.selection.slice() : []);
} }
}; };
@ -440,7 +440,7 @@ TableStore.prototype.cleanSelection = function() {
}); });
if (deleted.length) { if (deleted.length) {
this.table.$emit('selection-change', selection); this.table.$emit('selection-change', selection ? selection.slice() : []);
} }
}; };