rowClassName={this.setRowClassName}
setRowClassName = (record) => {
const { selectWorkContentId } = this.state;
let styleName = '';
if (record.formId === selectWorkContentId) {
styleName = 'selectWork';
}
return styleName;
};
rowClassName 行样式不起作用
原因:
selectWorkContentId使用(useRef
或直接声明的变量
)无法触发页面渲染
selectWorkContentId='' //this.selectWorkContentId
或
const dataRef = useRef({
selectWorkContentId:''
])
修改:
使用:this.setState
({selectWorkContentId:"'}),或useState