移动端, 输入搜索 没有搜索按钮的情况,如何触发搜索

在移动设备中,输入搜索,没有搜索按钮的情况下如何触发数据请求?要进行两步

  1.blur的时候进行数据请求: //ios手机触发

<input type='search'
value={this.state.courseName || ''}
placeholder='请输入课程名称/教师名称'
className='ipt'
ref={this.inputElement}
onChange={this.handleContentChange}
onBlur={this.blur}
onFocus={this.focus}
onKeyPress={(e) => {
this.pressIpt(e)
}}
/>
2.
onKeyPress 获取点击搜索按钮事件:
pressIpt = (e) => {  //安卓手机触发
if (e.keyCode === 0) { //点击搜索按钮
...
}
}
原文地址:https://www.cnblogs.com/lxs-616/p/14709500.html