Ver Fonte

Merge branch '2023-9-5_简谱和节奏'

liushengqiang há 1 ano atrás
pai
commit
ebc95ec172
2 ficheiros alterados com 13 adições e 0 exclusões
  1. 12 0
      index.html
  2. 1 0
      src/pc/App.tsx

+ 12 - 0
index.html

@@ -8,6 +8,18 @@
   <meta http-equiv="Cache-control" content="no-cache">
   <meta http-equiv="Cache" content="no-cache">
   <title>制谱</title>
+  <script>
+    window.addEventListener('error', function (event) {
+      if (event.target.tagName === 'SCRIPT' && event.target.src.indexOf('assets/index') > -1) {
+        var  total = sessionStorage.getItem('SCRIPT_ERROR')
+        total = Number(total) || 0
+        total = total + 1
+        sessionStorage.setItem('SCRIPT_ERROR', total)
+        if (total > 3) return;
+        window.location.reload()
+      }
+    }, true)
+  </script>
   <script src="//at.alicdn.com/t/c/font_4186350_idu6dqxtfd.js"></script>
   <script src="/flexible.js"></script>
   <script src="/abc2svg/xml2abc.js"></script>

+ 1 - 0
src/pc/App.tsx

@@ -49,6 +49,7 @@ export default defineComponent({
 				setToken(query.Authorization);
 			}
 			setUser();
+			sessionStorage.setItem('SCRIPT_ERROR', '0');
 		});
 
 		const inited = computed(() => {