在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
wxml结构(删除部分代码): <view class="chapter-item" wx:for="{{klgData}}" data-index="{{index}}" bind:touchstart="touchS" bind:touchmove="touchM" bind:touchend="touchE" wx:key="item.id"><!-- 主要代码 --> <view class="klg-content" style="{{item.contentStyle}}"><!-- 主要代码 --> <view class="left-side"> <image wx:if="{{item.image}}" mode="aspectFill" class="chapter-image" src="{{host+item.image}}" /> </view> <view class="right-side"> <text class="chapter-text chapter-name">{{item.title}}</text> <text class="chapter-text chapter-time">时长:{{item.duration}}</text> </view> </view> <view class="operates" style="{{item.btnStyle}}"><!-- 主要代码 --> <view class="klg-btn returnBtn" catchtap="removeKlg"> <image mode="aspectFill" data-id="{{item._id}}" data-klgid="{{item.klgid}}" class="btn-icon" src="../../images/video_icon_value.png" /> 撕书 </view> <view class="klg-btn shareBtn"><image data-id="{{item.id}}" mode="aspectFill" class="btn-icon" src="../../images/video_point_icon_share.png" />分享</view> </view> </view>
wxss相关代码(主要是定位,已标识主要代码): .chapter-item{ overflow:hidden; border-bottom: 1px solid #eee; position: relative; height:80px; display: flex; } .left-side,.right-side{ float:left; display: inline-block;position:relative;height:58px; } .right-side{flex:1;} .left-side{width:105px;padding-right:10px;flex:0 0 105px} .chapter-name{flex:1;display:block;color:#2E3330;} .chapter-time{display:block;position:absolute;bottom:0;left:0;} .chapter-image{width:104px;height:58px;} .chapter-text{display: block;} .klg-content{position: absolute;left:12px;top:10px;}//主要代码 绝对定位 .operates{position: absolute;top:0;overflow:hidden;z-index: 99;right:-160px;}//主要代码 绝对定位 .klg-btn{color:#34BC67;width:80px;line-height: 60px; float: left;text-align: center;font-size: 16px;position: relative;padding-top:24px;} js相关代码: //这里delBtnWidth为160,存放在data里面 结果:
|
请发表评论