在 React Final Form 中,我们可以使用formatorparse属性作为text类型输入,以便存储与指定值不同的值,但这似乎与复选框的工作方式不同。
例子:
<FieldArray name='test' initialValue={[true, false]}>
<Field
component='input'
type='checkbox'
format={value => value ? 'foo' : null}
parse={value => value ? 'foo' : null}/>
</Field>
</FieldArray>
在此示例中,无论使用and ,要存储的值仍然是trueor 。是否可以将值格式化为to ?falseformatparse[true, false]["foo"]
提前感谢您的帮助。