diff --git a/packages/table/src/table-body.js b/packages/table/src/table-body.js
index d372bf5f9..33614e7bd 100644
--- a/packages/table/src/table-body.js
+++ b/packages/table/src/table-body.js
@@ -55,16 +55,74 @@ export default {
on-mouseleave={ _ => this.handleMouseLeave() }
class={ [this.getRowClass(row, $index)] }>
{
- this._l(this.columns, (column, cellIndex) =>
-
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])
+ this._l(this.columns, (column, cellIndex) => {
+ const { rowspan, colspan } = this.getSpan(row, column, $index, cellIndex);
+ 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]
+ )
+ }
+ |
+ );
}
-
- )
+ }
+ })
}
{
!this.fixed && this.layout.scrollY && this.layout.gutterWidth ? | : ''
@@ -186,6 +244,36 @@ export default {
}
},
+ getSpan(row, column, rowIndex, columnIndex) {
+ let rowspan = 1;
+ let colspan = 1;
+
+ const fn = this.table.spanMethod;
+ if (typeof fn === 'function') {
+ const result = fn({
+ row,
+ column,
+ rowIndex,
+ columnIndex
+ });
+
+ console.log(result);
+
+ if (Array.isArray(result)) {
+ rowspan = result[0];
+ colspan = result[1];
+ } else if (typeof result === 'object') {
+ rowspan = result.rowspan;
+ colspan = result.colspan;
+ }
+ }
+
+ return {
+ rowspan,
+ colspan
+ };
+ },
+
getRowStyle(row, index) {
const rowStyle = this.rowStyle;
if (typeof rowStyle === 'function') {
diff --git a/packages/table/src/table.vue b/packages/table/src/table.vue
index e35e41cc9..b4fe1d331 100644
--- a/packages/table/src/table.vue
+++ b/packages/table/src/table.vue
@@ -217,7 +217,9 @@
defaultSort: Object,
- tooltipEffect: String
+ tooltipEffect: String,
+
+ spanMethod: Function
},
components: {