重点的代码:
:row-style="setRowStyle"
这个属性就是在table标签绑定的
:row-style="setRowStyle"
// 这个方法直接加到methods里就好了,页面会自动调用的
setRowStyle(row) {
if (row.row.isPart == true) {
return 'color:blue;'
}
},
具体代码:
hmtl
<el-table width="100%" :data="gridData" border fit highlight-current-row :header-cell-style="{background:'#199ED8'}" :row-style="setRowStyle">
<el-table-column label="序号" type="index"></el-table-column>
</el-table>
js中就是方法的调用就好了
setRowStyle(row) {
if (row.row.isPart == true) {
return 'color:blue;'
}
},