Write the background color in the first row of the element table

There are methods in the documentation
Insert picture description here

   <el-table :data="tableData" stripe style="width: 100%" :header-cell-style="rowClass"></el-table>
   

Write this method in methods

    // 表格头第一行上色
rowClass({ row, rowIndex}) {
    console.log(rowIndex) //表头行标号为0
    return 'background:rgba(242, 242, 242, 1)'
},

Guess you like

Origin blog.csdn.net/weixin_45663264/article/details/108797181