From 7bc50662b904b52276a8420837a651023314fcd6 Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Fri, 17 Dec 2021 15:09:02 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=90=8C=E6=AD=A5=E5=AE=8C=E6=95=B4?= =?UTF-8?q?=E7=89=88=E5=88=86=E6=94=AF=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.production | 3 + build/index.ts | 3 +- package.json | 1 + pnpm-lock.yaml | 49 ++++++++++++++++ src/layout/components/sidebar/breadCrumb.vue | 56 ++++++++++++++++-- src/layout/components/tag/index.vue | 87 ++++++++++++++-------------- types/global.d.ts | 1 + vite.config.ts | 11 +++- 8 files changed, 160 insertions(+), 51 deletions(-) diff --git a/.env.production b/.env.production index 5537b0c..c636c82 100644 --- a/.env.production +++ b/.env.production @@ -6,3 +6,6 @@ VITE_ROUTER_HISTORY = "hash" # 线上环境后端地址 VITE_PROXY_DOMAIN_REAL = "" + +# 是否为打包后的文件提供传统浏览器兼容性支持 支持 true 不支持 false +VITE_LEGACY = false \ No newline at end of file diff --git a/build/index.ts b/build/index.ts index 7280839..4127d62 100644 --- a/build/index.ts +++ b/build/index.ts @@ -6,7 +6,8 @@ const warpperEnv = (envConf: Recordable): ViteEnv => { VITE_PUBLIC_PATH: "", VITE_PROXY_DOMAIN: "", VITE_PROXY_DOMAIN_REAL: "", - VITE_ROUTER_HISTORY: "" + VITE_ROUTER_HISTORY: "", + VITE_LEGACY: false }; for (const envName of Object.keys(envConf)) { diff --git a/package.json b/package.json index a1ab3dd..f22621e 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "@types/qs": "^6.9.7", "@typescript-eslint/eslint-plugin": "4.31.0", "@typescript-eslint/parser": "4.31.0", + "@vitejs/plugin-legacy": "^1.6.4", "@vitejs/plugin-vue": "^1.10.2", "@vitejs/plugin-vue-jsx": "^1.3.1", "@vue/eslint-config-prettier": "6.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 624692c..2627e86 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,6 +15,7 @@ specifiers: "@types/qs": ^6.9.7 "@typescript-eslint/eslint-plugin": 4.31.0 "@typescript-eslint/parser": 4.31.0 + "@vitejs/plugin-legacy": ^1.6.4 "@vitejs/plugin-vue": ^1.10.2 "@vitejs/plugin-vue-jsx": ^1.3.1 "@vue/compiler-sfc": ^3.2.24 @@ -121,6 +122,7 @@ devDependencies: "@types/qs": 6.9.7 "@typescript-eslint/eslint-plugin": 4.31.0_f4e6dc0776b3600ef484e3c64a523136 "@typescript-eslint/parser": 4.31.0_eslint@7.30.0+typescript@4.4.2 + "@vitejs/plugin-legacy": 1.6.4_vite@2.6.14 "@vitejs/plugin-vue": 1.10.2_vite@2.6.14 "@vitejs/plugin-vue-jsx": 1.3.1 "@vue/eslint-config-prettier": 6.0.0_82e4252401b0cc5be86f7c2133946f49 @@ -495,6 +497,14 @@ packages: - supports-color dev: true + /@babel/standalone/7.16.6: + resolution: + { + integrity: sha512-wjildVe951w1IPEPN4G76j+y5JFZfJN9gdyP8o9zd61qbiVEecAgORKskK1D/7VrJZrZS+nxDbhj2akEFU2RJw== + } + engines: { node: ">=6.9.0" } + dev: true + /@babel/template/7.16.0: resolution: { @@ -1257,6 +1267,23 @@ packages: eslint-visitor-keys: 2.1.0 dev: true + /@vitejs/plugin-legacy/1.6.4_vite@2.6.14: + resolution: + { + integrity: sha512-geH2F3hTRN++E4n9NZ0JFumxIWUKqW4FA9PAgM7Q6RvUOUUYW4tlURhEmCBYfZSN24H/yX3mEolX+wFVErsAYQ== + } + engines: { node: ">=12.0.0" } + peerDependencies: + vite: ^2.0.0 + dependencies: + "@babel/standalone": 7.16.6 + core-js: 3.20.0 + magic-string: 0.25.7 + regenerator-runtime: 0.13.9 + systemjs: 6.11.0 + vite: 2.6.14_sass@1.43.4 + dev: true + /@vitejs/plugin-vue-jsx/1.3.1: resolution: { @@ -2305,6 +2332,14 @@ packages: safe-buffer: 5.1.2 dev: true + /core-js/3.20.0: + resolution: + { + integrity: sha512-KjbKU7UEfg4YPpskMtMXPhUKn7m/1OdTHTVjy09ScR2LVaoUXe8Jh0UdvN2EKUR6iKTJph52SJP95mAB0MnVLQ== + } + requiresBuild: true + dev: true + /cosmiconfig/7.0.1: resolution: { @@ -5297,6 +5332,13 @@ packages: strip-indent: 3.0.0 dev: true + /regenerator-runtime/0.13.9: + resolution: + { + integrity: sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA== + } + dev: true + /regexpp/3.2.0: resolution: { @@ -6009,6 +6051,13 @@ packages: stable: 0.1.8 dev: true + /systemjs/6.11.0: + resolution: + { + integrity: sha512-7YPIY44j+BoY+E6cGBSw0oCU8SNTTIHKZgftcBdwWkDzs/M86Fdlr21FrzAyph7Zo8r3CFGscyFe4rrBtixrBg== + } + dev: true + /table/6.7.2: resolution: { diff --git a/src/layout/components/sidebar/breadCrumb.vue b/src/layout/components/sidebar/breadCrumb.vue index 08ba0bb..989e225 100644 --- a/src/layout/components/sidebar/breadCrumb.vue +++ b/src/layout/components/sidebar/breadCrumb.vue @@ -1,11 +1,16 @@