Explorar o código

feat: fontSize报错修改

TIANYONG hai 11 meses
pai
achega
7d1b21b21c
Modificáronse 1 ficheiros con 20 adicións e 13 borrados
  1. 20 13
      public/flexible.js

+ 20 - 13
public/flexible.js

@@ -1,18 +1,25 @@
 ! function (a, b) {
   function c() {
-    var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
-    var height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
-    var b = width > height ? height : width;
-    b / i > 640 && (b = 640 * i);
-    b / i < 375 && (b = 375 * i);
-    var c = b / 10;
-    // 老师端,fontsize计算
-    // if (window.location.search.includes('platform=pc') || window.location.search.includes('platform=PC')) {
-    //   c = width / 21.7;
-    // }
-    // console.log('fontSize:',c,'屏幕宽度:',width,'老师端:',window.location.search.includes('platform=pc'))
-    f.style.fontSize = c + "px", k.rem = a.rem = c
-    window.fontSize = c
+    try {
+      var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
+      var height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
+      var b = width > height ? height : width;
+      b / i > 640 && (b = 640 * i);
+      b / i < 375 && (b = 375 * i);
+      var c = b / 10;
+      // 老师端,fontsize计算
+      // if (window.location.search.includes('platform=pc') || window.location.search.includes('platform=PC')) {
+      //   c = width / 21.7;
+      // }
+      // console.log('fontSize:',c,'屏幕宽度:',width,'老师端:',window.location.search.includes('platform=pc'))
+      c = c || 64;
+      f.style.fontSize = c + "px", k.rem = a.rem = c
+      window.fontSize = c
+    } catch (error) {
+      f.style.fontSize = 64 + "px"
+      window.fontSize = 64
+    }
+
   }
   var d, e = a.document,
     f = e.documentElement,