Ant-design: 多个选择框中的搜索功能循环遍历值而不是标签。

创建于 2017-11-15  ·  3评论  ·  资料来源: ant-design/ant-design

这个功能解决了什么问题?

我正在使用一个以 user_id 作为值和用户名作为标签的选择输入。 在多选模式中使用自动搜索时,它搜索的是 ID/值而不是用户名/标签。

提议的 API 是什么样的?

为选择输入提供一个参数会很好,例如:

最有用的评论

根据说明,应使用http://new-issue.ant.design创建新问题

optionFilterPropfilterOption允许您管理如何过滤可用选项,即

<Select
    showSearch
    optionFilterProp="children"
    filterOption={(input: any, option: any) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
   >
   ...
</Select>

以上将过滤大小写不敏感,按标签过滤可用选项。

这显示在文档https://ant.design/components/select/#components -select-demo-search

HTH

所有3条评论

根据说明,应使用http://new-issue.ant.design创建新问题

optionFilterPropfilterOption允许您管理如何过滤可用选项,即

<Select
    showSearch
    optionFilterProp="children"
    filterOption={(input: any, option: any) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
   >
   ...
</Select>

以上将过滤大小写不敏感,按标签过滤可用选项。

这显示在文档https://ant.design/components/select/#components -select-demo-search

HTH

谢谢加文!

没问题@remyvanderwereld

仅供参考,请使用新问题工具,否则问题往往会被屏蔽。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

alanwei0 picture alanwei0  ·  3评论

tianyacsdn picture tianyacsdn  ·  3评论

plandem picture plandem  ·  3评论

zhangchen2397 picture zhangchen2397  ·  3评论

shivekkhurana picture shivekkhurana  ·  3评论