【发布时间】:2019-08-30 04:01:00
【问题描述】:
目前,我的组件如下所示:
<Menu
id="customized-menu"
className={classes.root}
anchorEl={blogMenuAnchorEl}
getContentAnchorEl={null}
anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
transformOrigin={{ vertical: 'top', horizontal: 'center' }}
open={blogMenu}
onClose={closeBlogDropDown}
>
<MenuItem>
<ListItemText primary="Latest Posts" />
</MenuItem>
<Divider variant="fullWidth" />
<MenuItem>
<ListItemText primary="Learn French" />
</MenuItem>
<MenuItem>
<ListItemText primary="Learn Latin" />
</MenuItem>
<MenuItem>
<ListItemText primary="Learn Italian" />
</MenuItem>
</Menu>
);
当然,这个下拉菜单会缩小以适应它列出的项目。但是,如果我希望下拉菜单是全角的怎么办?我想他们称其为大型菜单。我尝试在组件的样式中添加width: '100%',但它没有效果,因为实际的下拉 div 是在运行时生成的,而我在编写脚本期间无法访问。
回购位于https://github.com/amitschandillia/proost/tree/master/web_SO,相关组件为https://github.com/amitschandillia/proost/blob/master/web_SO/components/BlogDropDown.jsx。
【问题讨论】:
标签: reactjs material-ui jss