📅  最后修改于: 2022-03-11 15:04:15.933000             🧑  作者: Mango
import React, { Component } from "react";
import { InputGroup, FormControl, Input } from "react-bootstrap";
class SimpleKeyEvent extends Component {
constructor() {
super();
this.state = {
name: "React-bootstrap key enter event"
};
this.onKeyUp = this.onKeyUp.bind(this);
}
onKeyUp(event) {
if (event.charCode === 13) {
this.setState({ inputValue: event.target.value });
}
}
render() {
const { inputValue } = this.state;
return (
Input value is : {inputValue}
);
}
}
export default SimpleKeyEvent;