0
私は変更の選択ボックスのthis
要素を取得しようとしています。
https://github.com/JedWatson/react-selectReactjs select - 入力の選択onChange
<Select
name="propertytype"
value={this.state.propertytype}
options={optionsPropertyType}
onChange={this.handlePropertyTypeChange}
placeholder="Property Type"
/>
私はハンドラを起動しthis
要素を取得しようとしています。しかし、onChange
関数は、選択ボックスのvalue
とlabel
を取得するだけです。
handlePropertyTypeChange: function(val) {
console.log("this -property change", this);
console.log("val", val);
this.setState({propertytypename: val.label});
this.setState({propertytype: val.value});
},
を反応させ、 'はconsole.log(「この-propertyチェンジ」何、this) 'と' console.log( "val"、val) '出力? – Rashmirathi
'イベント 'が必要ですか? –
ここの 'this'要素は' react-select'要素ではないあなたの反応クラスです –