我想出了如何使用 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?
},
另外,有没有办法设置默认选择的选项?
谢谢!