Bläddra i källkod

第三方库优化

zhengnaiwen_citu 3 månader sedan
förälder
incheckning
c4b41064d6
2 ändrade filer med 57 tillägg och 57 borttagningar
  1. 9 9
      src/main.js
  2. 48 48
      vue.config.js

+ 9 - 9
src/main.js

@@ -1,25 +1,25 @@
 import 'core-js/stable'
 import 'regenerator-runtime/runtime'
+import 'whatwg-fetch' // fetch ie 11
+import '@babel/polyfill'
+import 'scrolling-element'
+import promise from 'es6-promise'
+import VueCompositionAPI from '@vue/composition-api'
 import Vue from 'vue'
 import App from './App.vue'
 import router from './router'
 import store from './store'
 import ElementUI from 'element-ui'
+import './permission' // 路由守卫
+import './autoComponents'
+// 引入自定义指令
+import Directives from './directives/index.js'
 import 'element-ui/lib/theme-chalk/index.css'
 import '@mdi/font/css/materialdesignicons.min.css'
-import 'whatwg-fetch' // fetch ie 11
-import './permission' // 路由守卫
-import promise from 'es6-promise'
 // 引入公用scss
 import '@/styles/index.scss'
 import '@/styles/orangeTheme.scss'
-import './autoComponents'
-import VueCompositionAPI from '@vue/composition-api'
-// 引入自定义指令
-import Directives from './directives/index.js'
-import 'scrolling-element'
 
-import '@babel/polyfill'
 // require('@babel/polyfill')
 promise.polyfill()
 

+ 48 - 48
vue.config.js

@@ -16,50 +16,50 @@ module.exports = defineConfig({
     open: true,
     // host: 'localhost',
     port: 9000,
-    hot: true
+    hot: true,
     // https: false,
-    // proxy: {
-    //   '/op/base': {
-    //     // target: 'http://192.168.3.162:7654',
-    //     target: 'https://company.citupro.com:18182/op/base',
-    //     secure: false, // 是否支持 https,默认 false
-    //     changeOrigin: true, // 是否支持跨域
-    //     headers: {
-    //       // 确保包含这些头部以兼容IE11
-    //       Accept: 'application/json',
-    //       'Content-Type': 'application/json; charset=utf-8'
-    //     },
-    //     onProxyReq (proxyReq) {
-    //       // 对于IE11的特殊处理
-    //       if (proxyReq.getHeader('origin')) {
-    //         proxyReq.setHeader('origin', 'https://company.citupro.com:18182/op/base')
-    //       }
-    //     },
-    //     pathRewrite: {
-    //       '^/op/base': ''
-    //     }
-    //   },
-    //   '/op/base/api': {
-    //     // target: 'http://192.168.3.162:7654',
-    //     target: 'https://company.citupro.com:18183',
-    //     secure: false, // 是否支持 https,默认 false
-    //     changeOrigin: true, // 是否支持跨域
-    //     headers: {
-    //       // 确保包含这些头部以兼容IE11
-    //       Accept: 'application/json',
-    //       'Content-Type': 'application/json; charset=utf-8'
-    //     },
-    //     onProxyReq (proxyReq) {
-    //       // 对于IE11的特殊处理
-    //       if (proxyReq.getHeader('origin')) {
-    //         proxyReq.setHeader('origin', 'https://company.citupro.com:18183')
-    //       }
-    //     },
-    //     pathRewrite: {
-    //       '^/op/base/api': '/op/base/api'
-    //     }
-    //   }
-    // }
+    proxy: {
+      '/op/base': {
+        // target: 'http://192.168.3.162:7654',
+        target: 'https://company.citupro.com:18182/op/base',
+        secure: false, // 是否支持 https,默认 false
+        changeOrigin: true, // 是否支持跨域
+        headers: {
+          // 确保包含这些头部以兼容IE11
+          Accept: 'application/json',
+          'Content-Type': 'application/json; charset=utf-8'
+        },
+        onProxyReq (proxyReq) {
+          // 对于IE11的特殊处理
+          if (proxyReq.getHeader('origin')) {
+            proxyReq.setHeader('origin', 'https://company.citupro.com:18182/op/base')
+          }
+        },
+        pathRewrite: {
+          '^/op/base': ''
+        }
+      },
+      '/op/base/api': {
+        // target: 'http://192.168.3.162:7654',
+        target: 'https://company.citupro.com:18183',
+        secure: false, // 是否支持 https,默认 false
+        changeOrigin: true, // 是否支持跨域
+        headers: {
+          // 确保包含这些头部以兼容IE11
+          Accept: 'application/json',
+          'Content-Type': 'application/json; charset=utf-8'
+        },
+        onProxyReq (proxyReq) {
+          // 对于IE11的特殊处理
+          if (proxyReq.getHeader('origin')) {
+            proxyReq.setHeader('origin', 'https://company.citupro.com:18183')
+          }
+        },
+        pathRewrite: {
+          '^/op/base/api': '/op/base/api'
+        }
+      }
+    }
   },
   configureWebpack: config => {
     config.devtool = 'source-map'
@@ -134,13 +134,13 @@ module.exports = defineConfig({
     'echarts',
     'decimal.js',
     'nprogress',
-    'element-resize-detector'
+    'element-resize-detector',
 
     // 使用正则匹配更广泛的包
-    // /node_modules\/@wangeditor/,
-    // /node_modules\/vue-/,
-    // /node_modules\/element-ui/,
-    // /node_modules\/echarts/
+    /node_modules\/@wangeditor/,
+    /node_modules\/vue-/,
+    /node_modules\/element-ui/,
+    /node_modules\/echarts/
   ],
   // 移除console
   terser: {