diff --git a/packages/table/src/table-body.js b/packages/table/src/table-body.js index 3132b288..f859eb1c 100644 --- a/packages/table/src/table-body.js +++ b/packages/table/src/table-body.js @@ -116,7 +116,7 @@ export default { !this.fixed && this.layout.scrollY && this.layout.gutterWidth ? : '' } , - this.store.states.expandRows.indexOf(row) > -1 + this.store.isRowExpanded(row) ? ( { this.table.renderExpanded ? this.table.renderExpanded(h, { row, $index, store: this.store }) : ''} diff --git a/packages/table/src/table-store.js b/packages/table/src/table-store.js index b273548f..4d2b43b8 100644 --- a/packages/table/src/table-store.js +++ b/packages/table/src/table-store.js @@ -405,6 +405,15 @@ TableStore.prototype.toggleRowExpansion = function(row, expanded) { } }; +TableStore.prototype.isRowExpanded = function(row) { + const { expandRows = [], rowKey } = this.states; + if (rowKey) { + const expandMap = getKeysMap(expandRows, rowKey); + return !!expandMap[getRowIdentity(row, rowKey)]; + } + return expandRows.indexOf(row) !== -1; +}; + TableStore.prototype.cleanSelection = function() { const selection = this.states.selection || []; const data = this.states.data;