我想在 Select onChange
时获得选项的值和键.
我知道我可以得到onChangeOption
函数中使用event.target.value
的选项value的简单性,但我怎么能得到key
呢?
<select onChange={this.onChangeOption} value={country}>
{countryOptions.map((item, key) =>
<option key={key} value={item.value}>
{item.name}
</option>
)}
</select>