一、实现效果
二、HTML
<view class="videoList">
<view class="video-item" wx:for="{{videoList}}" wx:key="item.id" bindtap="toDetail">
<view class="imgBox">
<image class="img" src="../../images/common/icon-user.png" />
<view class="duration">
<image class="duration-icon" src="../../images/common/triangle-white.png" />
<view class="duration-txt">{{item.duration}}</view>
</view>
</view>
<view class="video-detail">
<text class="detail-title">{{item.title}}</text>
<view class="detail-showed">
<image class="showed" src="../../images/common/videoShowed.png" />
<text class="time-txt">{{item.showed}}</text>
</view>
</view>
<view class="{{index%2 === 0 && videoList.length-index !== 2 && videoList.length-index !== 1? 'hasLine': 'noLine'}}"></view>
</view>
</view>
三、CSS
.videoList{
display: flex;
flex-wrap: wrap;
overflow: hidden;
justify-content: space-between;
}
.video-item:nth-child(even){
margin-right: 30rpx;
}
.video-item{
width: 330rpx;
padding-top: 24rpx;
margin-left: 30rpx;
}
.hasLine{
width: 750rpx;
height: 2rpx;
border-top: 2rpx solid #e4e4e4;
left: -30rpx;
position: relative;
}
.noLine{
display: none;
}