search

Home  >  Q&A  >  body text

javascript - Does the antdesign Select component support custom input (mode="tags") reporting an error?

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

天蓬老师天蓬老师2794 days ago1121

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-05-19 10:13:13

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

    reply
    0
  • 伊谢尔伦

    伊谢尔伦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>

    reply
    0
  • Cancelreply