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

  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的页面销毁,但是倒计时依旧继续的问题处理

上一篇:select last_insert_id()使用注意


下一篇:NoClassDefFoundError 和 ClassNotFoundException异常