【发布时间】:2020-07-27 10:55:31
【问题描述】:
我正在使用redux-form 和FieldArray。我在FieldArray 组件中有很多下拉菜单,并且在更改选择时我需要触发一些方法来处理更改。所以我需要使用可以有其他方法的组件(不是功能组件)。
到目前为止,我的代码如下,使用功能组件,但我还需要定义 customMethod 方法。
<FieldArray name="docList" component={docs} props={this.props}/>
const docs= ({...props, meta: {error, submitFailed}}) => {
const {fields} = props;
return (
{fields.map((doc, index) => (
<div>
<Field component={CustomCom} name={`${doc}.size`} label="size"
handleChange={(label, type) => this.customMethod(label, SIZE)}
placeholder="" value={props.sizeValue}/>
</div>
))}
请告诉我如何在 FieldArray 组件中使用其他/自定义方法。谢谢。
【问题讨论】: