答案 0 :(得分:1)
您是否尝试过传递defaultValue属性进行选择?
const renderDropDownField = ({ input, label, values, defaultValue }) => (
<Container>
<Row>
<Col sm="6">
<label className="input-label">{label}</label>
</Col>
<Col sm="6">
<Row>
<select defaultValue={defaultValue} className="dropdown-list" {...input} >
{values.map((value, index) => (
<option key={value} value={value}>{value}</option>
))}
</select>
</Row>
</Col>
</Row>
</Container>
答案 1 :(得分:0)
最简单的方法是使用JSX属性 defaultValue = {...}
<Row className="form-group">
<Label htmlFor="rating" xs={12}>Rating</Label>
<Col xs={12}>
<Control.select model=".rating" name="rating" id="rating"className="form-control"
**defaultValue={1}** >
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</Control.select>
</Col>
</Row>