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水印和字幕
  • 今日头条如何上传素材
  • 热门搜索
    安踏女运动鞋 提肛运动 牛腩是牛的什么部位 化学选修四知识点总结 典韦字什么 鱼腥草的作用 职工运动会简报 嘉宝果的功效与作用 甘露醇的作用 八年级上册地理知识点