Table data support to set cell className

Table data support to set cell className
This commit is contained in:
梁灏 2017-01-10 18:36:13 +08:00
parent f9f1865ca5
commit c211f71778
3 changed files with 39 additions and 10 deletions

View file

@ -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'))
}