소스 검색

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: {
         /**