| | |
| | | // 根据环境变量动态设置代理 |
| | | const proxyConfig = () => { |
| | | const devProxy = { |
| | | "/dev-api": { |
| | | target: "http://192.168.50.86:8080", // 开发环境的后端地址 |
| | | "/prod-api": { |
| | | target: "http://192.168.50.160:8080", // 开发环境的后端地址 |
| | | changeOrigin: true, |
| | | rewrite: (path) => path.replace(/^\/dev-api/, ""), |
| | | rewrite: (path) => path.replace(/^\/prod-api/, ""), |
| | | }, |
| | | }; |
| | | |
| | | const testProxy = { |
| | | "/stage-api": { |
| | | "/prod-api": { |
| | | target: "http://192.168.50.160:8080", // 测试环境的后端地址 |
| | | changeOrigin: true, |
| | | rewrite: (path) => path.replace(/^\/stage-api/, ""), |
| | | rewrite: (path) => path.replace(/^\/prod-api/, ""), |
| | | }, |
| | | }; |
| | | |
| | | const prodProxy = { |
| | | "/stage-api": { |
| | | "/prod-api": { |
| | | target: "http://192.168.50.160:8080", // 测试环境的后端地址 |
| | | changeOrigin: true, |
| | | rewrite: (path) => path.replace(/^\/stage-api/, ""), |
| | | rewrite: (path) => path.replace(/^\/prod-api/, ""), |
| | | }, |
| | | }; |
| | | |