javascript - Does the antdesign Select component support custom input (mode="tags") reporting an error?
天蓬老师
天蓬老师 2017-05-19 10:11:13
0
2
1124

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

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(2)
小葫芦

This is the weirdest BUG, ​​I look forward to a master’s explanation

伊谢尔伦
<Option value={item.key.toString()} key={item.key.toString(){item.value } </Option>
你不是这里写错了,应该是这样的吧:
<Option value={item.key.toString()} key={item.key.toString()}>{item.value } </Option>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template