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水印和字幕
  • 今日头条如何上传素材
  • 热门搜索
    环保知识手抄报 关于网络安全的手抄报 关于名人的手抄报 楹联手抄报 清明节手抄报模板 奥运会手抄报 节俭手抄报 手抄报清明节 少年强则国强手抄报 关于过年的手抄报