<el-table :data="tableData" border style="width: 100%" highlight-current-row
:header-cell-style="cellStyle" >
methods:{
cellStyle({ row, column, rowIndex, columnIndex }){
if (column.label === '日期') {
return {
backgroundColor: 'pink'
}
}
if(true){
return{ background: '#eef1f6', color: '#606266' }
}
},
}
header-cell-style只能做颜色、字体大小之类的样式修改,且作用于整个单元格里的内容,不太容易给单元格里的一部分内容加样式
header-cell-style加在表格结构el-table上