123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <template>
- <view>
- <view class="flex alcenter">
- <text class="order-t" :class="size" :style="{background:bgColor,color:color}">{{showT.h}}</text><text class="ft12 ftw600 plr5">:</text>
- <text class="order-t" :class="size" :style="{background:bgColor,color:color}">{{showT.m}}</text><text class="ft12 ftw600 plr5">:</text>
- <text class="order-t" :class="size" :style="{background:bgColor,color:color}">{{showT.s}}</text>
- </view>
- </view>
- </template>
- <script>
- import helper from '@/static/js/helper.js';
-
- export default{
- props:{
- t:{
- type:Number,
- default:0,
- },
- size:{
- type:String,
- default:''
- },
- bgColor:{
- type:String,
- default:'#2E2F33'
- },
- color:{
- type:String,
- default:'#ffffff'
- }
- },
- data(){
- return {
- myT:0,
- timer:null,
- }
- },
- computed:{
- showT(){
- let myT = this.myT;
-
- return helper.djsFull(myT);
- }
- },
- created(){
- this.myT = this.t;
- this.djs();
- },
- destroyed(){
- if(this.timer != null){
- clearInterval(this.timer);
- }
- },
- methods:{
- djs(){
- if(this.timer){
- clearInterval(this.timer);
- }
- this.timer = setInterval(()=>{
- if(this.myT == 0){
- clearInterval(this.timer);
- }else{
- this.myT = this.myT - 1;
- }
- },1000);
- }
- }
- }
- </script>
- <style>
- .order-t{
- width:48rpx;
- height:48rpx;
- background:#FFFFFF;
- text-align: center;
- line-height: 48rpx;
- font-size:28rpx;
- font-weight: 500;
- color: #000000;
- border-radius: 8rpx;
- }
- .order-t.small{
- width: 40rpx;
- height: 40rpx;
- font-size: 24rpx;
- line-height: 40rpx;
- }
- </style>
|