From b851242a5c742427bbceac5f5c7e175365a13bd0 Mon Sep 17 00:00:00 2001 From: hetech Date: Tue, 2 Apr 2019 15:26:46 +0800 Subject: [PATCH] Table: `defaultExpandAll` works when expand column exists (#14935) * Table: `defaultExpandAll` works when expand column exists * fix --- packages/table/src/table-body.js | 6 +++++- test/unit/specs/table.spec.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/table/src/table-body.js b/packages/table/src/table-body.js index 8c02ea278..c36ad8991 100644 --- a/packages/table/src/table-body.js +++ b/packages/table/src/table-body.js @@ -127,7 +127,7 @@ export default { }) } ); - if (this.store.isRowExpanded(row)) { + if (this.hasExpandColumn && this.store.isRowExpanded(row)) { return [ tr, @@ -185,6 +185,10 @@ export default { return this.store.states.columns; }, + hasExpandColumn() { + return this.columns.some(({ type }) => type === 'expand'); + }, + firstDefaultColumnIndex() { for (let index = 0; index < this.columns.length; index++) { if (this.columns[index].type === 'default') { diff --git a/test/unit/specs/table.spec.js b/test/unit/specs/table.spec.js index 3cb1e7817..54a490188 100644 --- a/test/unit/specs/table.spec.js +++ b/test/unit/specs/table.spec.js @@ -949,7 +949,7 @@ describe('Table', () => { - +