From ef4caa96cbab475eb975121db82e4c9f2f1f6bb4 Mon Sep 17 00:00:00 2001 From: Jikkai Xiao Date: Mon, 16 Jul 2018 17:10:43 +0800 Subject: [PATCH] Table: support class-name when type=expand (#12006) --- packages/table/src/table-body.js | 73 ++++++++++-------------------- packages/table/src/table-column.js | 12 ++++- 2 files changed, 35 insertions(+), 50 deletions(-) diff --git a/packages/table/src/table-body.js b/packages/table/src/table-body.js index e9d940275..1986c0dcc 100644 --- a/packages/table/src/table-body.js +++ b/packages/table/src/table-body.js @@ -58,55 +58,30 @@ export default { if (!rowspan || !colspan) { return ''; } else { - if (rowspan === 1 && colspan === 1) { - return ( - this.handleCellMouseEnter($event, row) } - on-mouseleave={ this.handleCellMouseLeave }> - { - column.renderCell.call( - this._renderProxy, - h, - { - row, - column, - $index, - store: this.store, - _self: this.context || this.table.$vnode.context - }, - columnsHidden[cellIndex] - ) - } - - ); - } else { - return ( - this.handleCellMouseEnter($event, row) } - on-mouseleave={ this.handleCellMouseLeave }> - { - column.renderCell.call( - this._renderProxy, - h, - { - row, - column, - $index, - store: this.store, - _self: this.context || this.table.$vnode.context - }, - columnsHidden[cellIndex] - ) - } - - ); - } + return ( + this.handleCellMouseEnter($event, row) } + on-mouseleave={ this.handleCellMouseLeave }> + { + column.renderCell.call( + this._renderProxy, + h, + { + row, + column, + $index, + store: this.store, + _self: this.context || this.table.$vnode.context + }, + columnsHidden[cellIndex] + ) + } + + ); } }) } diff --git a/packages/table/src/table-column.js b/packages/table/src/table-column.js index 684954ca3..61ba14892 100644 --- a/packages/table/src/table-column.js +++ b/packages/table/src/table-column.js @@ -279,7 +279,17 @@ export default { sortOrders: this.sortOrders }); - objectAssign(column, forced[type] || {}); + let source = forced[type] || {}; + for (let prop in source) { + if (source.hasOwnProperty(prop)) { + let value = source[prop]; + if (value !== undefined) { + column[prop] = prop === 'className' + ? `${column[prop]} ${value}` + : value; + } + } + } this.columnConfig = column;