Ant Design Pro ProTable 根据不同数据设置表格每一行的样式

Ant Design React About 227 words

rowClassName

ProTablerowClassName参数,接收一个回调函数,参数是该行的数据。

可以拿到数据做进一步处理。

<ProTable<TableListItem>
  rowClassName={record => record.error ? "row-warning" : ""}
 />

在全局样式,或局部样式中定义类名。

.row-warning td {
  background-color: #fff1f0;
}
Views: 6 · Posted: 2026-09-01

———         Thanks for Reading         ———

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓
Prev Post
Today In History
Browsing Refresh