uni-app小程序24小时倒计时

 时间:2026-04-23 10:07:23

1、<template>

  <view>{{countdown}}</view>

</template>

2、<script>

export default {

data() {

h:23,//时

m:59,//分

s:59,//秒

countdown:'24:00:00',//倒计时

timer:null,//重复执行

};

};

</script>

3、onLoad(){

this.timer = setInterval(()=>{

   this.timeCount()

},1000)

},

4、methods: {

timeCount(){

--this.s;

if(this.s<0){

--this.m;

this.s=59;

}

    if(this.m<0){

--this.h;

this.m=59

}

if(this.h<0){

this.s=0;

this.m=0;

}

this.countdown = this.h+":"+this.m+":"+this.s

},

}

  • 剪映如何添加庞门体字体
  • Mac苹果电脑怎么下载b站视频
  • Procrate 怎么快速便捷的复制图层?
  • ffmpeg去除视频中的logo水印和字幕
  • 今日头条如何上传素材
  • 热门搜索
    牛肉饺子放什么菜好吃 棋牌游戏大全 短线选股方法 猎聘网怎么样 山药怎么炒好吃 绳结编法大全 腰痛治疗方法 去痘印的方法 h漫大全 身上出现小红点是怎么回事