如何在 react-bootstrap multi select 上设置 selected 值?
How to set selected values on react-boostrap multi select?
我一直在尝试这样的事情:
<FormControl componentClass="select" multiple value="['other1', 'other2']">
<option value="other1">other1</option>
<option value="other2">other2</option>
<option value="other3">other3</option>
<option value="other4">other4</option>
<option value="other5">other5</option>
</FormControl>
但我无法获得正确的语法,实际上我不确定它是否是正确的方法。
我在这里找到了答案:https://facebook.github.io/react/docs/forms.html
Note: You can pass an array into the value attribute, allowing you to
select multiple options in a select tag: .
从我原来的例子来看,这是正确的做法:
<FormControl componentClass="select" multiple value={['other1', 'other2']}>
<option value="other1">other1</option>
<option value="other2">other2</option>
<option value="other3">other3</option>
<option value="other4">other4</option>
<option value="other5">other5</option>
</FormControl>
我一直在尝试这样的事情:
<FormControl componentClass="select" multiple value="['other1', 'other2']">
<option value="other1">other1</option>
<option value="other2">other2</option>
<option value="other3">other3</option>
<option value="other4">other4</option>
<option value="other5">other5</option>
</FormControl>
但我无法获得正确的语法,实际上我不确定它是否是正确的方法。
我在这里找到了答案:https://facebook.github.io/react/docs/forms.html
Note: You can pass an array into the value attribute, allowing you to select multiple options in a select tag: .
从我原来的例子来看,这是正确的做法:
<FormControl componentClass="select" multiple value={['other1', 'other2']}>
<option value="other1">other1</option>
<option value="other2">other2</option>
<option value="other3">other3</option>
<option value="other4">other4</option>
<option value="other5">other5</option>
</FormControl>