React群聊组合头像

const demoAvatarImages = [
  'https://images.unsplash.com/photo-1546967191-fdfb13ed6b1e?ixlib=rb-1.2.1&q=80&fm=jpg&crop=faces&fit=crop&h=200&w=200&ixid=eyJhcHBfaWQiOjE3Nzg0fQ',
  'https://images.unsplash.com/photo-1546967191-fdfb13ed6b1e?ixlib=rb-1.2.1&q=80&fm=jpg&crop=faces&fit=crop&h=200&w=200&ixid=eyJhcHBfaWQiOjE3Nzg0fQ',
];

   <List.Item
          className="GroupChat-ListItem"
          prefix={
            <div className="GroupChat-ImageBox ">
              {demoAvatarImages.map((item) => (
                <Avatar className="GroupChat-Avatar " src={item} />
              ))}
            </div>
          }
        >
 </List.Item>

样式

.GroupChat-ImageBox {
  height: 5rem;
  width: 5rem;
  display: grid; //将容器设置为网格布局;
  grid-template-columns: repeat(
    3,
    1fr
  ); //设置网格列的数量和宽度。auto-fit表示自动适应容器宽度,minmax(100px, 1fr)表示每列的最小宽度为100px,最大宽度为1fr,即平均分配容器剩余宽度;
  grid-template-rows: repeat(
    3,
    1fr
  ); //设置网格行的高度为100px,保证九宫格图片呈正方形;
  grid-gap: 0.2rem;
  margin-top: 0.5rem;
}
.GroupChat-Avatar {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  background-color: #ccc;
  font-size: 20px;
  font-weight: bold;
  color: #fff;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值