index.tsx
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { FormItem, Select } from '@formily/antd-v5';
import { Field } from '@formily/react';
import cx from 'classnames';
import './index.less';
import { FieldProps } from '../../typings';
const SelectInput: React.FC<FieldProps> = (props) => {
const { name, title, options = [], validator = [], decoratorProps, componentProps } = props;
return (
<div className={cx('global_select')}>
<Field
{...props}
name={name}
title={title}
dataSource={options}
decorator={[
FormItem,
{
...decoratorProps,
},
]}
component={[
Select,
{
allowClear: true,
showSearch: true,
filterOption: (inputValue, option) => {
console.log('option.label3333', option.label);
let l = option.label + '';
return l && l.indexOf(inputValue) != -1;
},
...componentProps,
componenttypename: 'Select',
},
]}
validator={validator}
/>
</div>
);
};
export default SelectInput;