فهرست منبع

重新打开应用,激活service worker

Michael Wang 5 سال پیش
والد
کامیت
1abc4454ca
1فایلهای تغییر یافته به همراه17 افزوده شده و 0 حذف شده
  1. 17 0
      src/features/Login/Login.vue

+ 17 - 0
src/features/Login/Login.vue

@@ -394,6 +394,23 @@ export default {
         }
       );
       if (!response.ok || this.newVersionAvailable) {
+        if (
+          response.ok &&
+          this.newVersionAvailable &&
+          localStorage.getItem("__swReload")
+        ) {
+          window._hmt.push([
+            "_trackEvent",
+            "登录页面",
+            "service worker刷新失败",
+          ]);
+          this.$Message.destroy();
+          this.$Message.info({
+            content: "请重新打开程序。",
+            duration: 2 * 24 * 60 * 60,
+          });
+          return true;
+        }
         window._hmt.push([
           "_trackEvent",
           "登录页面",