ant实现指定列表中某一行高亮显示
- Table中定义:
rowClassName:this.setRowClassName - 写setRowClassName方法
setRowClassName = (record) => {
if(recode.col === true) {
return 'ant-table-row-selected'
}
}
注解:
col是后台传过来的,布尔类型true表示该行需要高亮显示;所以判断只要col是true就需要高亮显示;
ant-table-row-selected是ant自带的样式(背景色为蓝色),如果要自定义背景颜色,需在scss中定义。
rowClassName是ant自带的表格行的类名,类型是:
function(record,index):string,返回的是字符串类型