ソースを参照

全局通知出现在race condition,在route发生变化的时候,消除spin

Michael Wang 4 年 前
コミット
8087ff91fa
1 ファイル変更6 行追加0 行削除
  1. 6 0
      src/features/Login/GlobalNotice.vue

+ 6 - 0
src/features/Login/GlobalNotice.vue

@@ -17,6 +17,12 @@ export default {
         this.$Spin.hide();
       }
     },
+    $route(to) {
+      // 因为此时正在离开,应该不会影响到新页面的Spin。但是最好的办法确实是限制在本组件,也许vue3的 target 能帮助这里。
+      if (to.name !== "Login") {
+        this.$Spin.hide();
+      }
+    },
   },
   async created() {
     this.fetchNotice();