直接在onRow事件中,捕捉到当前的节点,然后设置它高亮,然后再设置其它行的节点恢复默认样式
<ProTable
actionRef={actionRef}
className="no-margin-bottom-table"
columns={columns}
{...config}
request={loadData}
rowKey="id"
scroll={{ x: 800 }}
onRow={(record, index) => {
return {
// 点击行事件
onClick: (a) => {
let s = a.target.parentNode.parentNode.childNodes
// 先重置为默认样式
for (var i = 0; i < s.length; i++) {
s[i].style.color = '#000000d9'
s[i].style.fontWeight = 'normal'
}
// 再设置高亮样式
a.target.parentNode.style.color = '#1890ff'
a.target.parentNode.style.fontWeight = 'bold'
},
}
}}
/>