微信小程序瀑布流布局纯css样式

最近发先我们ui设计师很喜欢这种瀑布流设计图,在日常开发中,应该会有小伙伴需要这样的瀑布流样式布局的商品列表,今天整理出相关的代码,如有需要可自取,效果图如下,如遇问题评论留言。

在这里插入图片描述
在这里插入图片描述
wxml


    <!-- 商品列表 -->
    <view class="fourth_all_goods">
    <view class="fourth_congoods flex-b"> 
      <view class="twoshop-shop-box" wx:for="{{2}}">
        <!-- beiin轮播图 -->
        <view class="congoods conListy" wx:if="{{index==0}}">
          <swiper class="congoods_fourth_swiper"  autoplay="{{true}}" indicator-dots="true" circular="true" duration="500" indicatorActiveColor="#FF5000"  interval="3000">
          <swiper-item wx:key='index' wx:for="{{5}}">
            <image class="swiper_img" bindtap="jump" data-url="{{item.jump}}"
              src="https://b.bdstatic.com/searchbox/icms/searchbox/img/%E4%B8%8A%E9%B2%9C%E4%BA%86%E5%AE%B6%E4%B9%A1.png">
            </image>
          </swiper-item>
          
        </swiper>
        </view>
        <!--end 轮播图 -->
        <!--开始; 商品列表 -->
      <view class="congoods" wx:for="{{5}}">
        <view class="fourthshop-shop-item">
          <image class="fourthshop-shopimg" src="https://b.bdstatic.com/searchbox/icms/searchbox/img/%E4%B8%8A%E9%B2%9C%E4%BA%86%E5%AE%B6%E4%B9%A1.png"></image>
          <view class="fourthshop-shop-main">
            <view class="fourthshop-shop-mainname">
              <!-- <text>自营</text> -->
              <image src="https://b.bdstatic.com/searchbox/icms/searchbox/img/%E4%B8%8A%E9%B2%9C%E4%BA%86%E5%AE%B6%E4%B9%A1.png"></image>
              <text class="fourthshop-shopname">商品列表商品列表商品列表商品列表商品列表</text>
            </view>
            <view class="flex">
              <view class="fourthshop-shopprice flex">
                <text>¥</text>
                <view>5555</view>
              </view>
              <view class="fourthshop-shop-ccc">¥888888</view>
            </view>
            <view class="fourthshop-shop-cccf">销量:9999999</view>
          </view>
          <view class="fourthshop-shopint">
            <qdd-icon fontsize="24" class="more-icon" name="iconfenxiang1" color="#fff"></qdd-icon>
            ¥<text>1111111</text> 
          </view>
        </view>
      </view>
      <!-- 结束 商品列表 -->
        <!--  -->
      </view>
      
    </view>

  </view>

wxss


.fourth_all_goods{
  padding: 0 20rpx;
 
}

.fourthshop-shop{
  position: relative;
  flex-wrap: wrap;
}
.fourthshop-shop-item{
  width: 345rpx;
  background: #FFFFFF;
  border-radius: 20rpx;
  margin-top: 20rpx;
}
.fourthshop-shop-item:nth-child(2n){
  float: right;
}
.fourthshop-shopimg{
  width: 345rpx;
  height: 345rpx;
  border-radius: 20rpx 20rpx 0 0;
}
.fourthshop-shop-main{
  padding: 0 24rpx 38rpx 26rpx;
}
.fourthshop-shop-mainname{
  overflow: hidden;
  text-overflow:ellipsis;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  font-size: 26rpx;
  font-weight: 500;
  color: #333333;
  line-height: 36rpx;
  padding-top: 20rpx;
}
.fourthshop-shop-mainname text:first-child{
  height: 30rpx;
  color: #fff;
  font-size: 20rpx;
  padding: 0 8rpx;
  margin-right: 5rpx;
  line-height: 30rpx;
  background: linear-gradient(180deg, #FF3503 0%, #FF0152 100%);
  border-radius: 5px;
}
.fourthshop-shop-mainname image,.fourthshop-shop-main image{
  width: 56rpx;
  height: 30rpx;
  position: relative;
  top: -2rpx;
  margin-right: 2rpx;
}

.fourthshop-shopname{
  font-size: 26rpx;
  font-weight: 500;
  color: #333333;
  line-height: 26rpx;
}

.fourthshop-shopint{
  width: 345rpx;
  height: 52rpx;
  line-height: 52rpx;
  background: linear-gradient(90deg, #FA3354, #FC5C45);
  border-radius: 0px 0px 20rpx 20rpx;
  font-size: 24rpx;
  text-align: center;
  color: #fff;
}
.fourthshop-shopint text{
  font-family: PingFang SC;
  font-weight: 800;
  font-size: 30rpx;
  color: #FFFFFF;
}
.fourthshop-shopprice{
  font-size: 30rpx;
  font-weight: 500;
  color: #FA3354;
  line-height: 44rpx;
  margin-top: 10rpx;
  font-family: PingFang SC;
}

.fourthshop-shopprice-icon{
  font-size: 18rpx;
}

.fourthshop-shop-ccc{
  font-size: 22rpx;
  font-weight: 500;
  color: #999999;
  line-height: 18rpx;
  margin-top: 25rpx;
  text-decoration: line-through;
  margin-left: 8rpx;
}

.fourthshop-shop-cccf{
  font-size: 22rpx;
  font-weight: 500;
  color: #999999;
  line-height: 18rpx;
  margin-top: 16rpx;
}

/* css瀑布流 */
.fourth_congoods{
  width: 710rpx;
  overflow: hidden;
  flex-wrap: wrap;
}
.twoshop-shop-box{
  width: 345rpx;
}
.congoods{
  border-radius: 20rpx;
  width: 345rpx;
  position: relative;
  margin-bottom: 20rpx;
  break-inside: avoid;
  box-sizing: border-box;
}
.conListy:first-child{
  height: 502rpx;
}
.conListy:first-child image{
  width: 345rpx;
  height: 502rpx;
  border-radius: 20rpx;
}

.congoods_fourth_swiper{
  height: 502rpx;
  border-radius: 20rpx;
  margin: 10rpx auto;
  overflow: hidden;
  position: relative;
}
.congoods_fourth_swiper .swiper_img{
  width: 100%;
  height: 100%;
  border-radius: 10rpx;
}

希望以上对有需要的你有帮助 笔芯

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值