小程序中商品列表倒计时的功能是怎样制作的
Admin 2022-05-30 群英技术资讯 504 次浏览
本文实例为大家分享了小程序实现列表倒计时的具体代码,供大家参考,具体内容如下
效果
HTML代码
<view class="hbMpBox" wx:for="{{mpThing}}" data-goodsId="{{item.goods_id}}" data-id="{{index}}" bindtap="navSeceGroup"> <view class="hbMpBox_l"> <image src="{{item.goods_img}}"></image> </view> <view class="hbMpBox_r"> <view class="hbMpBox_r_head">{{item.goods_name}}</view> <view class="hbMpBox_r_time"> <view class="syTime_tx " style="font-weight: 600;">距结束:</view> <view class="syTime_day">{{item.goods_time[0]}}天</view> <view class="syTime_time syTime_time1">{{item.goods_time[1]}}</view> <view class="syTime_time1">:</view> <view class="syTime_time syTime_time2">{{item.goods_time[2]}}</view> <view class="syTime_time1">:</view> <view class="syTime_time syTime_time3">{{item.goods_time[3]}}</view> </view> <view class="hbMpBox_r_price"> <view class="hbMpBox_r_price_l"> <view class="hbMpBox_r_price_l_box onFontNow" style="max-width: 400rpx;"> <text style="color: #999;">拼团价:</text><text style="color: #d13d4b;font-size: 34rpx;">¥{{item.secs_price}}</text> </view> </view> <view class="hbMpBox_r_price_r"> 趣拼团 </view> </view> </view> </view> <view class="indexMptxBox" wx:if="{{mpThing[0]}}" bindtap="secondGroupNav"> 点击查看更多 </view>
CSS代码
/*秒拼样式书写*/ .hbMpBox{ padding: 20rpx; background: #fff; display: flex; border-bottom: 2rpx #eee solid; } .hbMpBox .hbMpBox_l{ width: 155rpx; height: 140rpx; min-width: 155rpx; } .hbMpBox .hbMpBox_l image{ width: 100%; height: 100%; } .hbMpBox .hbMpBox_r{ width: 540rpx; margin-left: 20rpx; color: #333; font-size: 22rpx; position: relative; } .hbMpBox .hbMpBox_r .hbMpBox_r_bb{ display: flex; position: relative; margin-top: 10rpx; } .hbMpBox .hbMpBox_r .hbMpBox_r_l2{ position: relative; max-width: 270rpx; } .hbMpBox .hbMpBox_r .hbMpBox_r_hh{ font-size: 28rpx; max-width: 270rpx; } .hbMpBox .hbMpBox_r .hbMpBox_r_l2 .hbMpBox_r_l2_h{ font-size: 40rpx; } .hbMpBox .hbMpBox_r .hbMpBox_r_l2 .hbMpBox_r_l2_des{ width: 100%; margin-right: 20rpx; margin-top: 10rpx; color: #a8a8a8; line-height: 35rpx; height: 70rpx; word-break: break-all; text-overflow: ellipsis; display: -webkit-box; /** 对象作为伸缩盒子模型显示 **/ -webkit-box-orient: vertical; /** 设置或检索伸缩盒对象的子元素的排列方式 **/ -webkit-line-clamp: 2; /** 显示的行数 **/ overflow: hidden; /** 隐藏超出的内容 **/ } .hbMpBox .hbMpBox_r .hbMpBox_r_l2 .hbMpBox_r_l2_text{ font-weight: 600; color: #d13d4b; margin-top: 10rpx; } .hbMpBox .hbMpBox_r .hbMpBox_r_head{ font-size: 28rpx; } .hbMpBox .hbMpBox_r .hbMpBox_r_des{ margin-top: 4rpx; color: #999; } .hbMpBox .hbMpBox_r .hbMpBox_r_l2_Time{ font-size: 20rpx; color: #bdbdbd; word-spacing: 5rpx; } .hbMpBox .hbMpBox_r .hbMpBox_r_l2_Time .fontTime{ font-weight: 900; font-size: 26rpx; color: #7c7d7f; } .hbMpBox_r .hbMpBox_r_r2{ min-width: 210rpx; max-width: 48%; border: 2rpx #d13d4b solid; border-radius: 10rpx; max-height: 110rpx; position: absolute; right: 0rpx; height: 100%; } .hbMpBox_r .hbMpBox_r_r2 .hbMpBox_r_r2_in{ height: 54rpx; display: flex; justify-content: center; align-items: center; padding: 0rpx 10rpx; line-height: 54rpx; } .hbMpBox_r .hbMpBox_r_r2 .hbMpBox_r_r2_in1{ background: #d13d4b; color: #fff; } .hbMpBox_r .hbMpBox_r_r2 .hbMpBox_r_r2_in2{ color: #d13d4b; } .hbMpBox .hbMpBox_r .hbMpBox_r_time{ margin-top: 15rpx; font-size: 24rpx; display: flex; align-items: center; } .syTime_time{ padding: 3rpx 6rpx; background: #444; text-align: center; color: #fff; border-radius: 5rpx; margin: 0rpx 5rpx; } .hbMpBox .hbMpBox_r .hbMpBox_r_price{ margin-top: 20rpx; display: flex; justify-content: space-between; align-items: center; } .hbMpBox .hbMpBox_r .hbMpBox_r_price .hbMpBox_r_price_r{ background: #d13d4b; color: #fff; width: 150rpx; height: 50rpx; line-height: 50rpx; text-align: center; border-radius: 5rpx; } .indexMptxBox{ padding: 20rpx; text-align: center; font-size: 24rpx; }
JS代码(得到后台数据查询用FIND方法插入字段,直接遍历会有问题)
mpThing.find(function(v){ var aa = v.goods_time; var bb = util.dayTimeArr(aa); v.goods_time = bb that.setData({ mpThing:mpThing, }) var ref = setInterval(function(){ aa-- var timeArr = util.dayTimeArr(aa); v.goods_time = timeArr that.setData({ mpThing:mpThing, }) },1000); })
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
用jQuery怎样判断点击事件点击了几次?在一些项目中,有时候我们需要判断进行了多少次的点击事件,那么我们有什么方法可以实现这个效果呢?文中的示例代码介绍得很详细,有需要的朋友可以参考,接下来就跟随小编一起了解看看吧。
本文主要介绍了如何在Vue中动态添加类名,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
今天主要给大家分享关于JavaScript执行机制的内容,一些朋友对于这个内容不是很理解,因此下文会分享一下面试题来帮助大家理解JavaScript执行机制,感兴趣的朋友就继续往下看吧。
JavaScript属性操作,下文有实例供大家参考,对大家了解操作过程或相关知识有一定的帮助,而且实用性强,希望这篇文章能帮助大家,下面我们一起来了解看看吧。
node爬虫主要用的是三个插件requestcheeriomysql废话不多说直接上代码constrequest=require("request")constcheerio=require("cheerio")constmysql=require('mysql')varconnection=mysql.createConnection({//
成为群英会员,开启智能安全云计算之旅
立即注册Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008