<input
type="text"
value={this.state.names}
onChange={this.namesChange}
/>
// 更新数据
namesChange = e => {
this.setState(
{
names: e.target.value
},
() => {
// 获取最新的数据
console.log(this.state.names);
}
);
};
constructor() {
super();
this.state = {
names: "",
age: 10,
value: 1
};
}