Explorar o código

menulist beforeDestroy 使用方式修改

yunxing %!s(int64=5) %!d(string=hai) anos
pai
achega
efc19bd691
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  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: {
         /**