const rowSelection = {
type: 'radio',
selectedRowKeys,
onChange: this.handleSelectChange,
getCheckboxProps: record => {
if(record.flag==='Y') {
return {disabled: true};
} else {
return {};
}
},
};
<Table
rowKey="id"
rowSelection={rowSelection}
dataSource={tableData}
columns={this.columns}
/>
注意,我们应该返回一个对象而不是boolean,如果不是的话,则会报错
const rowSelection = {
type: 'radio',
selectedRowKeys,
onChange: this.handleSelectChange,
getCheckboxProps: record => {
if(record.flag==='Y') {
return ({disabled: true});
} else {
return null; // 报错,cannot read property 'disabled' of null
}
},
};