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

 时间:2026-02-12 22:24:08

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水印和字幕
  • 今日头条如何上传素材
  • 热门搜索
    四川九寨沟旅游攻略 陕西旅游出版社 运城旅游景点大全 楚雄旅游 旅游业的特点 老年旅游团 怒江旅游 泰顺旅游 贵州省旅游地图 苏杭旅游景点有哪些