1.更改表头,它有两种方式可以更改,一种可以直接在后面添加你想要的属性,另外一种是通过回调函数来更改属性。
<el-table
class="tables"
:size="contents.tableSize"
:show-header="contents.tableShowHeader"
:header-row-style="headerRowStyle"
:header-cell-style="{
color:'black',
backgroundColor:'#aaa',
border:'none',
}"
:row-style="rowStyle"
:cell-style="cellStyle"
:data="dataList"
>
第一种更改方式,直接加一个等号,后面跟属性。
第二种方式是跟回调函数
2.更改下面的单元格,这个只能用回调函数
rowStyle({ row, rowIndex}) {
if (rowIndex % 2 == 1) {
if(row === rowIndex) {
return {
// 更改属性这里也有两种方式,看个人喜好
color:this.contents.tableStripeFontColor,
'border':'1px solid #ccc',
}
}
} else {
return ''
}
},