官网代码(在取消选中状态的时候不生效)
rowSelection() {
return {
onChange: (selectedRowKeys, selectedRows) => {
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
},
getCheckboxProps: record => ({
props: {
disabled: record.name === 'Disabled User', // Column configuration not to be checked
name: record.name,
},
}),
};
},
修改后台的代码
rowSelection() {
const { selectedRowKeys } = this //必须加
return {
selectedRowKeys, //必须加
onChange: (selectedRowKeys, selectedRows) => {
this.selectedRowKeys = selectedRowKeys
this.selectedRows = selectedRows
},
getCheckboxProps: (record) => ({
props: {
disabled: record.status !== 3, // Column configuration not to be checked
status: record.status,
},
}),
}
},