import React from 'react';
import ReactDOM from 'react-dom';
class NInput extends React.Component {
constructor(props) {
super(props)
this.state = {
inputValue: 33
}
}
render() {
return (<div>
<input value={this.state.inputValue} onChange={(event) => this.changeValue(event)} />
</div>)
}
changeValue(event) {
console.log('event', event);
this.setState({
inputValue: event.target.value
});
}
}
ReactDOM.render(
<NInput />,
document.getElementById('root')
);
react 输入框数据绑定
最新推荐文章于 2023-08-23 20:08:09 发布