Эх сурвалжийг харах

feat: 微信端返回缓存问题处理

zhangyuhan 4 жил өмнө
parent
commit
e8c9537e33

+ 11 - 0
src/web/staticres/common-module/keep-tags/keep-tags-template.js

@@ -566,4 +566,15 @@ function checkBackSuccess () {
 }
 $(function () {
     checkBackSuccess()
+    if (utils.isWeiXinBrowser) {
+      var aTime = new Date().getTime()
+      window.addEventListener('pageshow', function(event) {
+        if (event.persisted || window.performance && window.performance.navigation.type == 2) {
+          var cTime = new Date().getTime()
+          if (cTime - aTime > 500) {
+            checkBackSuccess()
+          }
+        }
+      }, false);
+    }
 })