ElemeFE / ElemeFE/element-react
Select cannot query when it has filterMethod prop.
- Dominant language
- JavaScript
- Stars
- 2.8k
- Forks
- 435
- PR merge metrics
- No merged PRs in 30d
Description
### Description
当Select上有filterMethod时, 输入框输入异常。
### Reproduce Steps
如图所示,按一次 删除键,删除的内容会被置回来。

### 复现代码
```js
constructor(props) {
super(props);
this.state = {
options: this.getDefaultOptions(),
value: {
value: 'aaaa',
label: 'aaaa'
}
};
this.handleInput = this.handleInput.bind(this);
this.handleFilter = this.handleFilter.bind(this);
}
handleFilter(query) {
const allOptions = this.getDefaultOptions();
const options = query && query !== this.state.value.label
? allOptions.filter(item => item.label.toLowerCase().includes(query.toLowerCase()))
: allOptions;
this.setState({ options });
}
getDefaultOptions() {
return [{
value: 'aaaa',
label: 'aaaa'
}, {
value: 'aabb',
label: 'aabb'
}, {
value: 'bbbb',
label: 'bbbb'
}, {
value: 'bbcc',
label: 'bbcc'
}, {
value: 'cccc',
label: 'cccc'
}];
}
handleInput(selectedValue) {
const allOptions = this.getDefaultOptions();
const value = allOptions.find(item => item.value === selectedValue);
this.setState({ value });
console.log(value);
}
render() {
return (
{
this.state.options.map(el => {
return
})
}
)
}
```
### Error Trace (if possible)
### Solution
### Additional Information
Contributor guide
Assessment
This issue has not been assessed yet.