element table单元格 添加多个class
html,vue
<el-table ref="multipleSelection" :data="list" :cell-class-name="addTdClass" > <el-table-column type="selection"></el-table-column> <el-table-column v-for="item in tabHeadList2" :label="item.lable" :prop="item.value" :width="item.width"> </el-table-column> </el-table>
js row代表这一行的数据信息,column.这一行的节点信息 (column.property == ''id 代表这一行中id的一列)
多个class名称用空格分隔
methods: { addTdClass({row, column}) { if (row.code == '950') { if (column.property == "id") { return 'bgGreen tableTdHover' } else { return "bgGreen" } } } }