mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-15 17:31:25 +08:00
91821d4d3a
* feat: select edit demo to data driven * feat: edit demo to data driven Co-authored-by: 二货机器人 <smith3816@gmail.com>
1.0 KiB
1.0 KiB
order | title | ||||
---|---|---|---|---|---|
4 |
|
zh-CN
在搜索模式下对过滤结果项进行排序。
en-US
Search the options with sorting.
import { Select } from 'antd';
import React from 'react';
const App: React.FC = () => (
<Select
showSearch
style={{ width: 200 }}
placeholder="Search to Select"
optionFilterProp="children"
filterOption={(input, option) => (option?.label ?? '').includes(input)}
filterSort={(optionA, optionB) =>
(optionA?.label ?? '').toLowerCase().localeCompare((optionB?.label ?? '').toLowerCase())
}
options={[
{
value: '1',
label: 'Not Identified',
},
{
value: '2',
label: 'Closed',
},
{
value: '3',
label: 'Communicated',
},
{
value: '4',
label: 'Identified',
},
{
value: '5',
label: 'Resolved',
},
{
value: '6',
label: 'Cancelled',
},
]}
/>
);
export default App;