选择选项后下拉列表增加其大小(反应)
Dropdown increasing its size after selecting options (React)
如何固定下拉菜单,即在选择选项后,如果选项长度很大,下拉菜单会增加其大小。我不希望它增加,因为它会干扰它旁边的其他组件。
我的代码是这样的:
dropdown:{
marginTop: 17,
maxWidth: '120%'
},
<Typography variant="h3" component="h3" style={{ marginBottom: 10}} gutterBottom>
Region
<div className={classes.dropdown}>
<Dropdown
options={this.state.regionList}
onChange={this.handleRegionChange}
/>
</div>
</Typography>
请同时使用宽度和最大宽度。例如:
dropdown:{
marginTop: 17,
maxWidth: '200px'
width: '200px'
},
如何固定下拉菜单,即在选择选项后,如果选项长度很大,下拉菜单会增加其大小。我不希望它增加,因为它会干扰它旁边的其他组件。
我的代码是这样的:
dropdown:{
marginTop: 17,
maxWidth: '120%'
},
<Typography variant="h3" component="h3" style={{ marginBottom: 10}} gutterBottom>
Region
<div className={classes.dropdown}>
<Dropdown
options={this.state.regionList}
onChange={this.handleRegionChange}
/>
</div>
</Typography>
请同时使用宽度和最大宽度。例如:
dropdown:{
marginTop: 17,
maxWidth: '200px'
width: '200px'
},