mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 17:19:11 +08:00
91821d4d3a
* feat: select edit demo to data driven * feat: edit demo to data driven Co-authored-by: 二货机器人 <smith3816@gmail.com>
920 B
920 B
order | title | ||||
---|---|---|---|---|---|
1 |
|
zh-CN
展开后可对选项进行搜索。
en-US
Search the options while expanded.
import { Select } from 'antd';
import React from 'react';
const onChange = (value: string) => {
console.log(`selected ${value}`);
};
const onSearch = (value: string) => {
console.log('search:', value);
};
const App: React.FC = () => (
<Select
showSearch
placeholder="Select a person"
optionFilterProp="children"
onChange={onChange}
onSearch={onSearch}
filterOption={(input, option) =>
(option?.label ?? '').toLowerCase().includes(input.toLowerCase())
}
options={[
{
value: 'jack',
label: 'Jack',
},
{
value: 'lucy',
label: 'Lucy',
},
{
value: 'tom',
label: 'Tom',
},
]}
/>
);
export default App;