Skip to content

Commit

Permalink
Table: optimize getCellClass method
Browse files Browse the repository at this point in the history
  • Loading branch information
adaex committed Aug 25, 2021
1 parent 781fc30 commit e021807
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/table/src/table-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ export default {
}));
}

classes.push('el-table__cell');

return classes.join(' ');
},

Expand Down Expand Up @@ -369,7 +371,7 @@ export default {
return (
<td
style={ this.getCellStyle($index, cellIndex, row, column) }
class={ [...this.getCellClass($index, cellIndex, row, column), 'el-table__cell'] }
class={ this.getCellClass($index, cellIndex, row, column) }
rowspan={ rowspan }
colspan={ colspan }
on-mouseenter={ ($event) => this.handleCellMouseEnter($event, row) }
Expand Down
4 changes: 3 additions & 1 deletion packages/table/src/table-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default {
on-click={ ($event) => this.handleHeaderClick($event, column) }
on-contextmenu={ ($event) => this.handleHeaderContextMenu($event, column) }
style={ this.getHeaderCellStyle(rowIndex, cellIndex, columns, column) }
class={ [...this.getHeaderCellClass(rowIndex, cellIndex, columns, column), 'el-table__cell'] }
class={ this.getHeaderCellClass(rowIndex, cellIndex, columns, column) }
key={ column.id }>
<div class={ ['cell', column.filteredValue && column.filteredValue.length > 0 ? 'highlight' : '', column.labelClassName] }>
{
Expand Down Expand Up @@ -286,6 +286,8 @@ export default {
}));
}

classes.push('el-table__cell');

return classes.join(' ');
},

Expand Down

0 comments on commit e021807

Please sign in to comment.