react  表单
this.handleChange(key,e){
  [key]:e.target.value
}

submit=()=>{

  const {userName,age,status}=this.state;
  let parmas = {
    userName,
    age,
    status
  }

}

render(){

  const {userName,age,status}this.state;
  return(

    <div>
      

    <input type="text" value={userName} onClick={this.handleChange.bind(this,'userName')}/> 
    <input type="text" value={age} onClick={this.handleChange.bind(this,'age')}/> 
    <input type="text" value={status} onClick={this.handleChange.bind(this,'status')}/> 

    <button onClick={this.submit}>提交</button>


    <div>  

  )
}

 

posted on 2019-01-25 13:43  hdq用心微笑  阅读(1370)  评论(0编辑  收藏  举报