PanJiaChen / electron-vue-admin

vue electron admin template web: http://panjiachen.github.io/vue-admin-template
3.13k stars 987 forks source link

桌面端proxyTable配置代理不生效 #24

Open VincentChengzc opened 5 years ago

VincentChengzc commented 5 years ago

proxyTable: { '/api': { target: 'http://47.75.17.17/', // 接口的域名 // secure: false, // 如果是https接口,需要配置这个参数 changeOrigin: true, // 如果接口跨域,需要进行这个参数配置 pathRewrite: { '^/api': '' } } },

用的桌面端proxyTable配置代理不生效, 同样的配置下却在vue-element-admin 却可以跨域访问。

blueroseslol commented 5 years ago

Electron不存在跨域问题,说一下你的需求

VincentChengzc commented 5 years ago

写的桌面端想请求不同域名下的接口,因此想做代理。不知道electron-vue-admin是否支持

blueroseslol commented 5 years ago

在你得api模块中加入对应地址就好了

import axios from 'axios';

export const requestLogin = params => {return axios.post(`http://127.0.0.1:3000/login`,params).then(res => res.data); };