我一直在尝试这样的事情:
<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
注意:您可以将数组传递到value属性中,从而允许您在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>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句