Commit 943a4a73e5470ffc7fcdb76dcb160ceaf32df065
1 parent
dde57741
fix #5580 , close #5582
Showing
1 changed file
with
4 additions
and
2 deletions
Show diff stats
src/components/table/table-head.vue
@@ -171,7 +171,8 @@ | @@ -171,7 +171,8 @@ | ||
171 | this.$parent.selectAll(status); | 171 | this.$parent.selectAll(status); |
172 | }, | 172 | }, |
173 | handleSort (index, type) { | 173 | handleSort (index, type) { |
174 | - const column = this.columns[index]; | 174 | + // 在固定列时,寻找正确的 index #5580 |
175 | + const column = this.columns.find(item => item._index === index); | ||
175 | const _index = column._index; | 176 | const _index = column._index; |
176 | 177 | ||
177 | if (column._sortType === type) { | 178 | if (column._sortType === type) { |
@@ -180,7 +181,8 @@ | @@ -180,7 +181,8 @@ | ||
180 | this.$parent.handleSort(_index, type); | 181 | this.$parent.handleSort(_index, type); |
181 | }, | 182 | }, |
182 | handleSortByHead (index) { | 183 | handleSortByHead (index) { |
183 | - const column = this.columns[index]; | 184 | + // 在固定列时,寻找正确的 index #5580 |
185 | + const column = this.columns.find(item => item._index === index); | ||
184 | if (column.sortable) { | 186 | if (column.sortable) { |
185 | const type = column._sortType; | 187 | const type = column._sortType; |
186 | if (type === 'normal') { | 188 | if (type === 'normal') { |