0
我想获取更改选择框的this
元素。
https://github.com/JedWatson/react-selectReactjs选择 - 获取输入选择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(“本 - 属性变化” ,这个)'和'console.log(“val”,val)'输出? – Rashmirathi
你需要'事件'吗? –
这里'this'元素是你的反应类而不是'react-select'元素 –