【发布时间】:2015-10-09 04:33:49
【问题描述】:
我想出了如何使用 react-bootstrap 来显示一个下拉列表:
<DropdownButton bsStyle="success" title="Choose" onSelect={this.handleSelect} >
<MenuItem key="1">Action</MenuItem>
<MenuItem key="2">Another action</MenuItem>
<MenuItem key="3">Something else here</MenuItem>
</DropdownButton>
但是我应该如何编写 onSelect 的处理程序来捕获正在选择的选项?我试过了,但不知道里面写什么:
handleSelect: function () {
// what am I suppose to write in there to get the value?
},
另外,有没有办法设置默认选择的选项?
谢谢!
【问题讨论】: