diff --git a/src/components/table/mixin.js b/src/components/table/mixin.js index 02ed257..71c4b2c 100644 --- a/src/components/table/mixin.js +++ b/src/components/table/mixin.js @@ -1,9 +1,14 @@ export default { methods: { - alignCls (column, type) { + alignCls (column, type, row = {}) { + let cellClassName = ''; + if (row.cellClassName && column.key && row.cellClassName[column.key]) { + cellClassName = row.cellClassName[column.key]; + } return [ { - [`${column.className}`]: column.className && type === 'body', + [`${cellClassName}`]: cellClassName, // cell className + [`${column.className}`]: column.className && type === 'body', // column className [`${this.prefixCls}-column-${column.align}`]: column.align, [`${this.prefixCls}-hidden`]: (this.fixed === 'left' && column.fixed !== 'left') || (this.fixed === 'right' && column.fixed !== 'right') || (!this.fixed && column.fixed && (column.fixed === 'left' || column.fixed === 'right')) } diff --git a/src/components/table/table-body.vue b/src/components/table/table-body.vue index 287ba5e..23effc7 100644 --- a/src/components/table/table-body.vue +++ b/src/components/table/table-body.vue @@ -11,7 +11,7 @@ @mouseleave.stop="handleMouseOut(row._index)" @click.stop="clickCurrentRow(row._index)" @dblclick.stop="dblclickCurrentRow(row._index)"> -