浏览代码

menulist beforeDestroy 使用方式修改

yunxing 4 年之前
父节点
当前提交
efc19bd691
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      src/components/menuList.vue

+ 4 - 4
src/components/menuList.vue

@@ -87,10 +87,10 @@ export default {
         this.timer = setInterval(() => {
             this.getDraftNum()
         }, this.interval)
-    },
-    // 页面关闭时,清除定时器
-    beforeDestroy() {
-        clearInterval(this.timer)
+        // 页面销毁前,清除定时器
+        this.$once('hook:beforeDestroy', () => {
+            clearInterval(this.timer)
+        })
     },
     methods: {
         /**