若是我想改变这几个列的背景颜色,应该用什么操作,有详细的方法吗
在tabledata表格中添加 :cell-style="rowClass"
rowClass(data) {
if (data.column.label == "XXX") {
return "background: #D9EDF7;color:#34738f";
}
if (data.column.label == "XXX") {
return "background: #D9EDF7;color:#34738f";
}
if (data.column.label == "XXX") {
return "background: #D9EDF7;color:#34738f";
}
},
XX写你要改变列的名字就行了
cellStyle({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 0) {
// 指定列号
return 'background:red'
} else {
return ''
}
},
```css
td:nth-child(1){ background-color: #ccc; }
td:nth-child(2) { background-color: red; }
```