瀏覽代碼

解决低版本webview打开白屏问题

shmily1213 2 年之前
父節點
當前提交
01b067c74c
共有 4 個文件被更改,包括 64 次插入59 次删除
  1. 6 1
      package.json
  2. 27 27
      public/index.html
  3. 3 2
      src/main.js
  4. 28 29
      vue.config.js

+ 6 - 1
package.json

@@ -36,6 +36,7 @@
     "url": "https://gitee.com/y_project/RuoYi-Vue.git"
   },
   "dependencies": {
+    "@babel/polyfill": "^7.12.1",
     "@riophae/vue-treeselect": "0.4.0",
     "ali-oss": "^6.16.0",
     "axios": "0.21.0",
@@ -44,6 +45,7 @@
     "docxtemplater": "^3.23.2",
     "echarts": "4.9.0",
     "element-ui": "2.15.0",
+    "es6-promise": "^4.2.8",
     "file-saver": "^2.0.4",
     "fuse.js": "6.4.3",
     "highlight.js": "9.18.5",
@@ -98,6 +100,9 @@
   },
   "browserslist": [
     "> 1%",
-    "last 2 versions"
+    "last 1 major version",
+    "not dead",
+    "Android >= 4.4",
+    "Chrome >= 44"
   ]
 }

+ 27 - 27
public/index.html

@@ -12,34 +12,34 @@
   </title>
   <!--[if lt IE 11]><script>window.location.href='html/ie.html';</script><![endif]-->
   <script>
-    window.MathJax = {
-      tex: {
-        inlineMath: [
-          ["$", "$"],
-          ["\\(", "\\)"]
-        ],   //行内公式选择符
-        displayMath: [
-          ["$$", "$$"],
-          ["\\[", "\\]"]
-        ],   //段内公式选择符
-        autoload: {
-          color: [],
-          colorv2: ['color']
-        },
-        packages: { '[+]': ['noerrors', 'mathtools', 'ams'] }
-      },
-      options: {
-        skipHtmlTags: ["script", "noscript", "style", "textarea", "pre", "code", "a"],   //避开某些标签
-        ignoreHtmlClass: 'tex2jax_ignore',
-        processHtmlClass: 'tex2jax_process'
-      },
-      loader: {
-        load: ['input/asciimath', '[tex]/noerrors', '[tex]/mathtools', '[tex]/ams']
-      }
-    };
+    // window.MathJax = {
+    //   tex: {
+    //     inlineMath: [
+    //       ["$", "$"],
+    //       ["\\(", "\\)"]
+    //     ],   //行内公式选择符
+    //     displayMath: [
+    //       ["$$", "$$"],
+    //       ["\\[", "\\]"]
+    //     ],   //段内公式选择符
+    //     autoload: {
+    //       color: [],
+    //       colorv2: ['color']
+    //     },
+    //     packages: { '[+]': ['noerrors', 'mathtools', 'ams'] }
+    //   },
+    //   options: {
+    //     skipHtmlTags: ["script", "noscript", "style", "textarea", "pre", "code", "a"],   //避开某些标签
+    //     ignoreHtmlClass: 'tex2jax_ignore',
+    //     processHtmlClass: 'tex2jax_process'
+    //   },
+    //   loader: {
+    //     load: ['input/asciimath', '[tex]/noerrors', '[tex]/mathtools', '[tex]/ams']
+    //   }
+    // };
   </script>
-  <script async src="https://mingxuejingbang.oss-cn-beijing.aliyuncs.com/MathJaxFiles/3.2.0/es5/tex-svg-full.js"
-    id="MathJax-script"></script>
+  <!-- <script async src="https://mingxuejingbang.oss-cn-beijing.aliyuncs.com/MathJaxFiles/3.2.0/es5/tex-svg-full.js"
+    id="MathJax-script"></script> -->
   <!-- <script src="//cdn.bootcss.com/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
 	 <link rel="dns-prefetch" href="//cdn.mathjax.org" /> -->
   <style>

+ 3 - 2
src/main.js

@@ -1,7 +1,8 @@
-import 'babel-polyfill'
+import '@babel/polyfill'
 import Es6Promise from 'es6-promise'
-Es6Promise.polyfill()
 require('es6-promise').polyfill()
+Es6Promise.polyfill()
+
 import Vue from 'vue'
 
 // use code below to debug in mobile devices.

+ 28 - 29
vue.config.js

@@ -76,7 +76,6 @@ module.exports = {
   chainWebpack(config) {
     config.plugins.delete('preload') // TODO: need test
     config.plugins.delete('prefetch') // TODO: need test
-
     // set svg-sprite-loader
     config.module
       .rule('svg')
@@ -105,35 +104,35 @@ module.exports = {
               inline: /runtime\..*\.js$/
             }])
             .end()
-          config
-            .optimization.splitChunks({
-            chunks: 'all',
-            cacheGroups: {
-              libs: {
-                name: 'chunk-libs',
-                test: /[\\/]node_modules[\\/]/,
-                priority: 10,
-                chunks: 'initial' // only package third parties that are initially dependent
-              },
-              elementUI: {
-                name: 'chunk-elementUI', // split elementUI into a single package
-                priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
-                test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
-              },
-              commons: {
-                name: 'chunk-commons',
-                test: resolve('src/components'), // can customize your rules
-                minChunks: 3, //  minimum common number
-                priority: 5,
-                reuseExistingChunk: true
-              }
-            }
-          })
+          // config
+          //   .optimization.splitChunks({
+          //     chunks: 'all',
+          //     cacheGroups: {
+          //       libs: {
+          //         name: 'chunk-libs',
+          //         test: /[\\/]node_modules[\\/]/,
+          //         priority: 10,
+          //         chunks: 'initial' // only package third parties that are initially dependent
+          //       },
+          //       elementUI: {
+          //         name: 'chunk-elementUI', // split elementUI into a single package
+          //         priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
+          //         test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
+          //       },
+          //       commons: {
+          //         name: 'chunk-commons',
+          //         test: resolve('src/components'), // can customize your rules
+          //         minChunks: 3, //  minimum common number
+          //         priority: 5,
+          //         reuseExistingChunk: true
+          //       }
+          //     }
+          //   })
           config.optimization.runtimeChunk('single'),
-            {
-              from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
-              to: './' //到根目录下
-            }
+          {
+            from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
+            to: './' //到根目录下
+          }
         }
       )
   }