From ddddb2f36ee221c26d32c664ed1509c5adda7419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=85=88=E7=91=9E?= <1490493387@qq.com> Date: Sun, 2 Jan 2022 10:22:58 +0800 Subject: [PATCH] =?UTF-8?q?docs(README.md):=20=E6=B7=BB=E5=8A=A0=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E6=9D=A1=E5=92=8Cvite=E8=A7=A3=E5=86=B3=E8=B7=A8?= =?UTF-8?q?=E5=9F=9F=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f5b8fb92..82e1b09f 100644 --- a/README.md +++ b/README.md @@ -500,10 +500,54 @@ export default defineComponent({ vite-plugin-svg-icons 使用说明:https://github.com/anncwb/vite-plugin-svg-icons/blob/main/README.zh_CN.md -安装: +**安装** ``` npm i vite-plugin-svg-icons -D ``` + + ## 跨域处理 + + +**vite.config.ts** +``` +// 本地反向代理解决浏览器跨域限制 +server: { + host: 'localhost', + port: Number(env.VITE_APP_PORT), + open: true, // 运行自动打开浏览器 + proxy: { + [env.VITE_APP_BASE_API]: { + target: 'http://localhost:9999', + changeOrigin: true, + rewrite: path => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '') + } + } +} +``` + +## NProgress 进度条 + +**安装** +``` +npm install --save nprogress +``` + +**permission.ts** +``` +import NProgress from 'nprogress'; +import 'nprogress/nprogress.css' +NProgress.configure({showSpinner: false}) // 进度环显示/隐藏 + +router.beforeEach((to, from, next) => { + NProgress.start() + ... +}) + +router.afterEach(() => { + NProgress.done() +}) + +``` \ No newline at end of file