微信小程序css瀑布流布局仅做参考,css布局只会先渲染列,这种瀑布流并不实用

wxml

<view class=case-page>
  <view class=list-masonry>
    <view class=item-masonry wx:for="{{note}}">
      <image class="play" src=/images/news/play.png></image>
      <view class="item-content">
        <image class="videoimg" src={{item.url}} mode=widthFix></image>
        <text>下载</text>
      </view>
    </view>
  </view>
</view>

wxss

.case-page {
  padding: 10rpx 15rpx 30rpx;
}

.list-masonry {
  column-count: 2;
  column-gap: 10rpx;
}

.item-masonry {
  background-color: #fff;
  break-inside: avoid;
  box-sizing: border-box;
  padding: 5rpx;
  position: relative;
}

.play {
  width: 48rpx;
  height: 48rpx;
  z-index: 100;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
}

.videoimg {
  width: 100%;
  border-radius: 18rpx;
}
.item-content{
  position: relative;
}
.item-content text {
  width: 80rpx;
  height: 30rpx;
  text-align: center;
  line-height: 30rpx;
  font-size: 20rpx;
  color: #fff;
  border: 2rpx solid #fff;
  box-sizing: border-box;
  border-radius: 6rpx;
  position: absolute;
  right: 20rpx;
  bottom: 30rpx;
}

js

Page({
  /**
   * 页面的初始数据
   */
  data: {
    imgWidth: 0,imgHeight: 0,note: [
      {
        title: 案例名称,url: http://zq.jhcms.cn/attachs/photo/201711/20171130_176CFE51B6710715B1BBBEF2F86ACB0C.jpg,},{
        title: 你所不知道的红酒知识,url: http://img3.imgtn.bdimg.com/it/u=1417732605,3777474040&fm=26&gp=0.jpg,{
        title: 红酒知识,url: http://f10.baidu.com/it/u=121654667,1482133440&fm=72,{
        title: 案例名称,url: http://zq.jhcms.cn/attachs/photo/201711/20171130_9E39DA252E3946BE36218D85876C4AB4.jpg,3777474040&fm=26&gp=0.jpg
      },1482133440&fm=72
      },url: http://img4.imgtn.bdimg.com/it/u=2748975304,2710656664&fm=26&gp=0.jpg
      },url: http://img2.imgtn.bdimg.com/it/u=1561660534,130168102&fm=26&gp=0.jpg
      },3777474040&fm=26&gp=0.jpg
      }
    ]
  }
})

相关文章

Css常用的排序方式权重分配 排序方式: 1、按类型&#160;...
原文:https://www.cnblogs.com/wenruo/p/9732704.html 先上...
css属性:word-wrap:break-word; 与 word-break:break-all 的...
https://destiny001.gitee.io/color/
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML...
css之background的cover和contain的缩放背景图 对于这两个属...