标签: reactjs react-select
我的UI中有一个用例,其中对于react-select组件,我想在下拉列表中显示标签,但是当我们选择标签时,显示的所选选项应该是label + value。 我该如何实施?
答案 0 :(得分:0)
使用formatOptionLabel道具为“选定”选项(在搜索字段中显示)创建布局,但使用自定义Option布局为“选项”的显示(或,相反,使用道具创建“选项”布局,并提供自定义的SingleValue或MultiValueLabel组件以在搜索字段中显示)。
formatOptionLabel
Option
SingleValue
MultiValueLabel
文档告诉您how to apply custom components。