首页 > 其他 > 详细

vue的页面销毁,但是倒计时依旧继续的问题处理

时间:2021-08-04 19:15:47      阅读:11      评论:0      收藏:0      [点我收藏+]
  data () {
    return {
      timer : null
    }
  },
  beforeDestroy () {
    let that = this;
    clearInterval(that.timer);
    that.timer = null;
  },
  destroyed () {
    let that = this;
    clearInterval(that.timer);
    that.timer = null;
  },
  mounted () {
    let that = this;
    that.timer = window.setInterval(() => {
      setTimeout(() => {
        that.getData()
      }, 0)
    },1000)
  },

  

vue的页面销毁,但是倒计时依旧继续的问题处理

原文:https://www.cnblogs.com/chenzhengyang/p/15099877.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!