-
-
Notifications
You must be signed in to change notification settings - Fork 490
Expand file tree
/
Copy pathmul-tag-suggest.tsx
More file actions
67 lines (59 loc) · 1.3 KB
/
mul-tag-suggest.tsx
File metadata and controls
67 lines (59 loc) · 1.3 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* eslint-disable no-console */
import React from 'react';
import Select, { Option } from '@rc-component/select';
import '../../assets/index.less';
import { fetch } from './common/tbFetchSuggest';
class Test extends React.Component {
state = {
data: [],
value: [],
};
onChange = (value) => {
console.log('onChange ', value);
this.setState({
value,
});
};
onSelect = (value) => {
console.log('select ', value);
};
fetchData = (value) => {
fetch(value, (data) => {
this.setState({
data,
});
});
};
render() {
const { value, data } = this.state;
const options = data.map((d) => (
<Option key={d.value}>
<i>{d.text}</i>
</Option>
));
return (
<div>
<h2>multiple suggest</h2>
<div>
<Select
style={{ width: 500 }}
labelInValue
optionLabelProp="children"
value={value}
onChange={this.onChange}
mode="tags"
placeholder="placeholder"
notFoundContent=""
onSearch={this.fetchData}
onSelect={this.onSelect}
filterOption={false}
>
{options}
</Select>
</div>
</div>
);
}
}
export default Test;
/* eslint-enable */