以input事件爲例:html
html代碼:this
<Input placeholder="電子郵箱" value={this.state.addEmail} onChange={this.addInputChange} onBlur={this.checkEmail.bind(this,'flagAddEmail')} />
注意最後一行,bind的參數爲(this,‘你要傳的參數’)code
js代碼如何接收參數:htm
checkEmail(name,evt) { console.log(name); //flagAddEmail console.log(evt.target.value); //input中輸入的值 }