react使用antd实现可输可选的功能

单选的可输可选

 const options = [
      { value: "容易", text: "容易" },
      { value: "困难", text: "困难" },
      { value: "顺利", text: "顺利" },
    ]
    <AutoComplete
      allowClear
      options={options}
      style={{ width: "96%" }}
      value={bindData.postoperativeUmmary}
      onChange={(value) => {
        this.setInheritVal(value, "postoperativeUmmary")
      }}
    />

多选的可输可选

使用mode=‘tags’就可以了

 <Select
   mode="tags"
   style={{ width: "96%" }}
   value={bindData.specialInstructions}
   allowClear
   onChange={(value) => {
     this.setInheritVal(value, "specialInstructions")
   }}
 >
   {renderOptions(initSelect, "169")}
 </Select>

版权声明:本文为qq_43567834原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。