我正在使用react-select(https://react-select.com),并且试图在MenuList本身(顶部)中添加搜索输入,而不是从Container中搜索的默认行为。
<Select
...
components={{
...
MenuList: (props: any) => {
return (
<components.MenuList {...props}>
<div className="search-wrapper">
<input
value={search}
onChange={searchChange}
placeholder="Search"/>
</div>
{props.children}
</components.MenuList>
);
},
}}
>
</Select>
它正在运行,并且在菜单顶部我得到了很好的输入:
,但是输入似乎被禁用。 (在输入中添加disable = false不会产生任何影响)
有什么想法吗?为什么会发生? 实现这种功能的正确方法是什么?