【发布时间】:2020-05-29 20:50:03
【问题描述】:
我在我的应用程序中使用了 react-select 来实现下拉功能。我想捕捉用户是否按下了“Enter”按钮/键。我做过这样的事情:
render(){
const props = {
className: 'search-combobox',
placeholder: "search something",
onChange: this._onSelectionChange.bind(this),
onSelect: this.props.onSelectedItem,
options: this.state.options(),
filterOptions: this._filterOptions.bind(this),
onInputChange: this._onInputChange.bind(this),
valueKey: 'id',
};
return(
<Select {...props}
autoFocus={true}
clearable={true}
closeOnSelect={true}
escapeClearsValue={true}
onBlurResetsInput={false} />);
}
所以在 _onInputChange 方法上,我尝试了 this._onInputChange.bind(this, event)。它没有用。那么如何捕获事件
【问题讨论】:
标签: javascript reactjs