官方文档:
代码:
const columns = [
{
title: 'Identity',
dataIndex: 'Identity',
key: 'Identity',
width: '10%',
},
{
title: 'Path',
dataIndex: 'Path',
key: 'Path',
width: '10%',
},
{
title: 'Reason',
dataIndex: 'Reason',
key: 'Reason',
},
{
title: 'Replay',
dataIndex: 'Replay',
key: 'Replay',
width: '30%',
},
{
title: 'Online',
dataIndex: 'Online',
key: 'Online',
width: '30%',
},
];
const transformColumns = columns.map((column) => ({
...column,
onCell: (record: any) => ({ style: { background: record.Highlight ? '#fff2f0' : undefined } }), // 这里
}));
效果: