reactjs - 材质 UI ListItemSecondaryAction 在 ListItem 中垂直对齐
问题描述
我在使用 Action 创建 ListIem 时遇到了@material-ui/core 问题。当文本变长时,我想保持ListItemSecondaryAction
领先,有什么办法可以克服它:ListItemAvatar
secondary
<ListItem alignItems="flex-start">
<ListItemAvatar>
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" />
</ListItemAvatar>
<ListItemText
primary="Brunch this weekend?"
secondary={
<React.Fragment>
<Typography
component="span"
variant="body2"
className={classes.inline}
color="textPrimary"
>
Ali Connors
</Typography>
{
" — I'll be in your neighborhood doing errands this…I'll be in your neighborhood doing errands this…I'll be in your neighborhood doing errands this…"
}
</React.Fragment>
}
/>
<ListItemSecondaryAction>
<IconButton edge="end" aria-label="delete">
<DeleteIcon />
</IconButton>
</ListItemSecondaryAction>
</ListItem>
正如您在此处看到的,delete
当文本变长时,图标会损坏,所以我希望垂直对齐保持它像ListItemAvatar
. 任何帮助将不胜感激,谢谢!
CodeSandBox 玩
解决方案
添加此样式将解决您的问题:
<ListItemSecondaryAction style={{top:"0%", marginTop:"35px"}}>
推荐阅读
- python - 如何使用 Python 3 正确显示倒计时日期
- angular - 无法从 Angular 中的 Firebase 获取对象的密钥
- arrays - 更改“DraggableViewBackground.m”中的一些代码
- c# - C# 中的显式结构需要双重初始化值
- python-3.x - 块缩进 jupyter notebook
- openrefine - 从协调列中获取其他语言的 wikidata 标签
- python - Notepad ++正则表达式每隔一个字符位置插入随机字母或数字
- c# - 列表省略标记的 C# JSON 列表
- python - ValueError:时间数据“无”与格式“%Y-%m-%d %H:%M:%S”不匹配
- python - Keras LSTM 尝试创建模型架构的多个错误