When using the select component of antdesign, you need to use the support input function. According to the document, the mode="tags" attribute is added, and the key value is also added to the option, but an error is still reported. Here is my code:
<FormItem label="请输入版本号">
{
getFieldDecorator('appversion', {initialValue: ''})(
<Select mode="tags" style={{ width: '140px' }}>
{ this.state.appverCodeList }
</Select>
)
}
</FormItem>
const appverCodeList = res.map((item) => {
return(
<Option value={item.key.toString()} key={item.key.toString(){item.value } </Option>
)
})
this.setState({ appverCodeList })
Error message: Uncaught Error: must set key for <rc-animate> children
伊谢尔伦2017-05-19 10:13:13
<Option value={item.key.toString()} key={item.key.toString(){item.value } </Option>
你不是这里写错了,应该是这样的吧:
<Option value={item.key.toString()} key={item.key.toString()}>{item.value } </Option>