📅  最后修改于: 2022-03-11 15:03:58.153000             🧑  作者: Mango
class App extends React.Component{
constructor(){
super();
this.state = {value: ''};
this.onChange = this.onChange.bind(this)
}
onChange(e){
const re = /^[0-9\b]+$/;
if (e.target.value === '' || re.test(e.target.value)) {
this.setState({value: e.target.value})
}
}
render(){
return
}
}
ReactDOM.render( ,document.getElementById('app'))