学无先后,达者为师

网站首页 Vue 正文

第二天0点定时调用某个方法(vue)

作者:月亮鞋业 更新时间: 2022-01-05 Vue
    timeRefresh(){
      let nowTime = new Date().valueOf();//获取当前时间戳
      let nowDay = nowTime % 86400000;//今天过了多少毫秒
      let haveTime = 86400000 - nowDay;//今天还剩多少毫秒
      //再过多少秒刷新
      setTimeout(()=>{
        this.timeRefresh();
      }, haveTime);
    }

原文链接:https://blog.csdn.net/m0_55118640/article/details/122099352

栏目分类
最近更新