From 3f5bfef2b6822991d7ae1423850b777fa35cae2c Mon Sep 17 00:00:00 2001 From: fengchenchen Date: Mon, 14 Nov 2022 15:44:44 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90update=E3=80=91=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E9=9D=99=E6=80=81=E5=9B=BE=E7=89=87=E7=9A=84?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 +++++++++++++++++ vue.config.js | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/README.md b/README.md index 47bb06f..2ff8ee2 100644 --- a/README.md +++ b/README.md @@ -48,3 +48,20 @@ yarn build ### Customize configuration See [Configuration Reference](https://cli.vuejs.org/config/). + +## 开发注意 +需要单独启动nginx做本地文件的转发 +####nginx中增加配置项 +``` +location /api/home/pic { + alias D:\\ProjectInformation\\library\\upload\\; #对应后台配置文件中的文件上传地址 + } +``` +#### vue.config.js -- proxy中增加配置项 +``` + // 请求静态图片配置项 + '/api/home/pic': { + target: 'http://127.0.0.1:7061', // 图片请求的nginx网址 + changeOrigin: true + } +``` diff --git a/vue.config.js b/vue.config.js index 52bd291..23db507 100644 --- a/vue.config.js +++ b/vue.config.js @@ -14,7 +14,13 @@ module.exports = { '/api': { target: 'http://127.0.0.1:7060', // 服务器 changeOrigin: true, + }, + // 请求静态图片配置项 + '/api/home/pic': { + target: 'http://127.0.0.1:7061', // 图片请求的nginx网址 + changeOrigin: true } + } }, chainWebpack: config => {