Ant Design table自定义复选框的默认不可选状态
官网上的getCheckboxProps中的disabled的值是record.name==="XXX",我在用的过程中肯定是一个list,然后我就想用函数返回true或false,虽然功能不影响,但是打印台一直报错,提示disabled支持布尔,不支持函数。后来才找到办法解决,下面直接上代码
table定义
<a-table
:loading="loading"
rowKey="userId"
:rowSelection="{
selectedRowKeys: selectedRowKeys,
onChange: onSelectChange,
onSelect: selectEvent,
onSelectAll: onSelectAll,
getCheckboxProps: getCheckboxProps
}"
:columns="column"
:dataSource="tableList"
:pagination="false"
/>关键在于:getCheckboxProps
getCheckboxProps(record) {
return ({
props: {
disabled: record.isaudit==1
}
})
},

