react中 Ender键 触发事件数(输入框) cyccgirl 2018-08-27 255 阅读1分钟 在input 标签上添加 onKeyPress={this.handleKeyPress} <//input type=”text” onKeyPress={this.handleKeyPress}/> 函数:handleKeyPress = (e) => { if (e.key === ‘Enter’) { this.createNewToDoItem();//调用其他函数 } };