input输入框enter键入
作者:
Ysj1111 | 来源:发表于
2018-09-04 08:41 被阅读8次<input ref="searchipt" placeholder="PLEASE ENTER SEARCH KEYWORDS"
onKeyPress={(event)=> this.onKeyPress(event)}
onFocus={this.handleFocus.bind(this)}
onBlur={this.handleBlur.bind(this)}
/>
onKeyPress=(e)=>{
// console.log(e);
let keyCode = null;
if(e.which){
keyCode = e.which;
}
else if(e.keyCode)
{
keyCode = e.keyCode;
}
if(keyCode === 13)
{
let str = this.refs.searchipt.value;
this.props.search(str);
// console.log(str);
this.refs.searchipt.value = '';
return false;
}
return true;
}
本文标题:input输入框enter键入
本文链接:https://www.haomeiwen.com/subject/xgdysxtx.html
网友评论