答案 0 :(得分:0)
您可以执行以下操作:
class Hello extends React.Component {
constructor(props) {
super(props);
this.state = {
values: [12312312321, 1231232142412, 1231232313, 12312312312],
}
}
render() {
return (
<form>
<FormGroup controlId="formControlsSelect">
<ControlLabel>Select</ControlLabel>
<br />
<FormControl componentClass="select" placeholder="select">
<option value="select">Select...</option>
{this.state.values.map(num => {
return <option key={num} value={num}>{num.toString().length > 6 ? num.toString().slice(0, 5).concat('...') : num}</option>
})}
</FormControl>
</FormGroup>
</form>
)
}
}
这里是fiddle example。