1、ref
//class
my_filter(reg){
const inpVal = this.input.value;
console.log(inpVal);
console.log(reg);
};
//render
<input type="text" ref={input => this.input = input} defaultValue = 'helloworld!' />
<button onClick = {this.my_filter.bind(this, reg)}> 确定 </button>
2、this.setState({})
//class
this.state = {
inpVal : 'helloworld'
};
my_filter(e){
this.setState({ inpValu:e.target.value })
};
//render
<input type="text" onChange={this.my_filter.bind(this)} defaultValue={this.state.inpValu}/>