react-select isMulti过滤选项

react-select isMulti filtering options

我正在使用 react-select。我不想从选项列表中删除选定的项目。看起来它会在您添加 isMulti 时自动从选项列表中删除选定的选项,因为当我没有 isMulti 时,它不会删除选定的选项。我看到我可以使用一个名为 filterOption 的道具,但我不明白如何让它工作。谁能告诉我即使选择了某些选项,如何使用 filterOption 来显示所有选项?如果 Select 自动删除所选选项,有没有人建议我如何显示所有选项,即使选择了某些选项?

  import Select from 'react-select';

  ...

  <Select
    value={this.value()}
    isDisabled={this.props.disabled}
    closeMenuOnSelect={false}
    components={Animated}
    isMulti
    isClearable
    onChange={this.props.onChange}
    onBlur={this.onBlur}
    options={this.props.options}
  />

顺便说一句:我可以看到有一个选项可以在 DEMO 中取消选中 "Remove selected options",但我无法找到源代码,它 returns 404。这里是 link 到我正在查看的演示,标题为 "Multiselect":https://jedwatson.github.io/react-select/

我认为你要找的选项是hideSelectedOptions,你可以查看文档here and a live example here