【发布时间】:2018-07-27 16:23:21
【问题描述】:
我需要根据记录的字段值显示不同的选择。
我需要的代码如下所示:
const myChoicesGenerator = (record) => {
if (record.field === false) {
return ['a', 'b'];
} else {
return ['b', 'c'];
}
<SelectInput ... choices = {myChoicesGenerator}/>
但不幸的是,我无法在“选择”属性中传递函数,所以这段代码不起作用。
有办法吗?
【问题讨论】:
标签: react-admin