怎么使用react改变Input的valueexport default class myForm extends Component{ constructor(props){ super(props); this.state = { id: '', }; } change=()=>{ var idInput = this.refs.idInput; ***// TODO 怎么改变input的值*** } render(){ return( <Input ref="idInput" placeholder="请输入" onChange={e => this.setState({id:e.target.value})} /> <Button onClick={this.change} /> ) }}
添加回答
举报
0/150
提交
取消
