Reactjs AsyncTypeahead选项在搜索后立即消失
选项短暂返回,然后立即消失。在选项返回后,组件似乎会自动重新渲染Reactjs AsyncTypeahead选项在搜索后立即消失,reactjs,react-bootstrap-typeahead,Reactjs,React Bootstrap Typeahead,选项短暂返回,然后立即消失。在选项返回后,组件似乎会自动重新渲染 <AsyncTypeahead isLoading={this.state.isLoading} onSearch={query => { this.setState({isLoading: true}); fetch(`http://localhost/coalmining/app_dev.
<AsyncTypeahead
isLoading={this.state.isLoading}
onSearch={query => {
this.setState({isLoading: true});
fetch(`http://localhost/coalmining/app_dev.php/getTypeOfInjuryIncapacity?query=${query}`,{
method: "GET",
})
.then(resp => resp.json())
.then(json => this.setState({
isLoading: false,
options: json.data,
}))
;
}}
labelKey={'value'}
options={this.state.options}
/>
{
this.setState({isLoading:true});
取回(`http://localhost/coalmining/app_dev.php/getTypeOfInjuryIncapacity?query=${query}`{
方法:“获取”,
})
.then(resp=>resp.json())
.then(json=>this.setState({
孤岛加载:false,
选项:json.data,
}))
;
}}
labelKey={'value'}
选项={this.state.options}
/>