Commit 0d323fcb by liimin

refactor(expressInfo): 重构网格布局为flex以替代浮动布局

移除易错的nth-child间距处理逻辑,使用flex gap统一管理间距,通过flex: 0 0 120px固定单元格尺寸防止布局变形
1 parent 23de226a
...@@ -98,24 +98,23 @@ export default { ...@@ -98,24 +98,23 @@ export default {
padding: 4px 0 14px; padding: 4px 0 14px;
} }
.express_grid { .express_grid {
overflow: hidden; // flex 布局:图片/视频统一 120px 固定尺寸,间距均匀,排不下自动换行
display: flex;
flex-wrap: wrap;
// 行、列统一间距;不用 margin + nth-child 那种易错写法
gap: 12px;
} }
.express_cell { .express_cell {
// width: calc(50% - 8px); // 固定 120×120,禁止拉伸/收缩(flex: 0 0 120px 保证不会被均匀分配挤变形)
width:120px; flex: 0 0 120px;
width: 120px;
height: 120px; height: 120px;
margin-right: 16px;
margin-bottom: 16px;
float: left;
box-sizing: border-box; box-sizing: border-box;
padding: 4px; padding: 4px;
border: 1px dashed #e4e7ed; border: 1px dashed #e4e7ed;
// 圆角由格子统一兜住,图片/视频组件只管内容 // 圆角由格子统一兜住,图片/视频组件只管内容
border-radius: 4px; border-radius: 4px;
overflow: hidden; overflow: hidden;
&:nth-child(2n) {
margin-right: 0;
}
} }
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!