vue如何解决跨域问题

开发环境:
配置config文件夹中index.js文件:
proxyTable: {
'/api': {
target: 'http://10.10.1.242:8245',//后端地址
// secure: false, // 如果是https接口,需要配置这个参数
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
}
html页面访问接口:
export function getTest(params) {
return post(`/api/tbk/dg_optimus_material`, params);
}
生产环境:安装配置nginx

猜你喜欢

转载自www.cnblogs.com/xlfdqf/p/11128053.html