mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 19:50:05 +08:00
parent
9ef7b23b53
commit
dfaa647950
@ -25,7 +25,7 @@ class Complete extends React.Component {
|
|||||||
dataSource: [],
|
dataSource: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChange = (value) => {
|
handleSearch = (value) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
dataSource: !value ? [] : [
|
dataSource: !value ? [] : [
|
||||||
value,
|
value,
|
||||||
@ -46,7 +46,7 @@ class Complete extends React.Component {
|
|||||||
dataSource={dataSource}
|
dataSource={dataSource}
|
||||||
style={{ width: 200, height: 50 }}
|
style={{ width: 200, height: 50 }}
|
||||||
onSelect={onSelect}
|
onSelect={onSelect}
|
||||||
onChange={this.handleChange}
|
onSearch={this.handleSearch}
|
||||||
placeholder="input here"
|
placeholder="input here"
|
||||||
>
|
>
|
||||||
<textarea onKeyPress={this.handleKeyPress} style={{ height: 50 }} />
|
<textarea onKeyPress={this.handleKeyPress} style={{ height: 50 }} />
|
||||||
|
@ -25,7 +25,7 @@ class Complete extends React.Component {
|
|||||||
dataSource: [],
|
dataSource: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChange = (value) => {
|
handleSearch = (value) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
dataSource: !value ? [] : [
|
dataSource: !value ? [] : [
|
||||||
value,
|
value,
|
||||||
@ -42,7 +42,7 @@ class Complete extends React.Component {
|
|||||||
dataSource={dataSource}
|
dataSource={dataSource}
|
||||||
style={{ width: 200 }}
|
style={{ width: 200 }}
|
||||||
onSelect={onSelect}
|
onSelect={onSelect}
|
||||||
onChange={this.handleChange}
|
onSearch={this.handleSearch}
|
||||||
placeholder="input here"
|
placeholder="input here"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -23,7 +23,7 @@ class Complete extends React.Component {
|
|||||||
result: [],
|
result: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChange = (value) => {
|
handleSearch = (value) => {
|
||||||
let result;
|
let result;
|
||||||
if (!value || value.indexOf('@') >= 0) {
|
if (!value || value.indexOf('@') >= 0) {
|
||||||
result = [];
|
result = [];
|
||||||
@ -41,7 +41,7 @@ class Complete extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<AutoComplete
|
<AutoComplete
|
||||||
style={{ width: 200 }}
|
style={{ width: 200 }}
|
||||||
onChange={this.handleChange}
|
onSearch={this.handleSearch}
|
||||||
placeholder="input here"
|
placeholder="input here"
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
@ -57,7 +57,7 @@ class Complete extends React.Component {
|
|||||||
dataSource: [],
|
dataSource: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChange = (value) => {
|
handleSearch = (value) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
dataSource: value ? searchResult(value) : [],
|
dataSource: value ? searchResult(value) : [],
|
||||||
});
|
});
|
||||||
@ -73,7 +73,7 @@ class Complete extends React.Component {
|
|||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
dataSource={dataSource.map(renderOption)}
|
dataSource={dataSource.map(renderOption)}
|
||||||
onSelect={onSelect}
|
onSelect={onSelect}
|
||||||
onChange={this.handleChange}
|
onSearch={this.handleSearch}
|
||||||
placeholder="input here"
|
placeholder="input here"
|
||||||
optionLabelProp="text"
|
optionLabelProp="text"
|
||||||
>
|
>
|
||||||
|
@ -26,6 +26,7 @@ const dataSource = ['12345', '23456', '34567'];
|
|||||||
| allowClear | Show clear button, effective in multiple mode only. | boolean | false |
|
| allowClear | Show clear button, effective in multiple mode only. | boolean | false |
|
||||||
| onChange | Called when select an option or input value change, or value of input is changed | function(value, label) | - |
|
| onChange | Called when select an option or input value change, or value of input is changed | function(value, label) | - |
|
||||||
| onSelect | Called when a option is selected. param is option's value and option instance. | function(value, option) | - |
|
| onSelect | Called when a option is selected. param is option's value and option instance. | function(value, option) | - |
|
||||||
|
| onSearch | Called when searching items. | function(value) | - |
|
||||||
| disabled | Whether disabled select | boolean | false |
|
| disabled | Whether disabled select | boolean | false |
|
||||||
| defaultActiveFirstOption | Whether active first option by default | boolean | true |
|
| defaultActiveFirstOption | Whether active first option by default | boolean | true |
|
||||||
| placeholder | placeholder of input | string | - |
|
| placeholder | placeholder of input | string | - |
|
||||||
|
@ -27,6 +27,7 @@ const dataSource = ['12345', '23456', '34567'];
|
|||||||
| allowClear | 支持清除, 单选模式有效 | boolean | false |
|
| allowClear | 支持清除, 单选模式有效 | boolean | false |
|
||||||
| onChange | 选中 option,或 input 的 value 变化时,调用此函数 | function(value) | 无 |
|
| onChange | 选中 option,或 input 的 value 变化时,调用此函数 | function(value) | 无 |
|
||||||
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | 无 |
|
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | 无 |
|
||||||
|
| onSearch | 搜索补全项的时候调用 | function(value) | 无 |
|
||||||
| disabled | 是否禁用 | boolean | false |
|
| disabled | 是否禁用 | boolean | false |
|
||||||
| defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true
|
| defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true
|
||||||
| placeholder | 输入框提示 | string | - |
|
| placeholder | 输入框提示 | string | - |
|
||||||
|
Loading…
Reference in New Issue
Block a user