要素は、テーブルヘッダー、行、および指定されたセルスタイルを変更します
テーブルのスタイルを変更する
関数またはオブジェクトのヘッダーセルスタイルの属性を使用します
- 関数の記述
<!-- html -->
<el-table :header-cell-style="rowClass"></el-table>
//在method里面写上方法
rowClass({
row, rowIndex}) {
console.log(rowIndex) //表头行标号为0
return 'background:red'
}
2.オブジェクトの書き込み
<!-- html -->
<el-table :header-cell-style="{background:'red'}"></el-table>
テーブル内のセルのスタイルを変更する
1.関数の記述
<!-- html -->
<el-table :header-cell-style="cellStyle"></el-table>
//在method里面写上方法
cellStyle({
row, column, rowIndex, columnIndex}){
if(rowIndex === 1 && columnIndex === 2){
//指定坐标
return 'background:pink'
}else{
return ''
}
}
2.オブジェクトの書き込み
<!-- html -->
<el-table :cell-style="{background:'pink'}"></el-table>