vue的web端解决跨域请求问题
module.exports = {
publicPath: './',
devServer: {
proxy: {
//配置跨域
'/api': {
target: 'http:/IP:端口号',
changOrigin: true, //允许跨域
pathRewrite: {
'^/api': ''
}
}
}
}
}
关注我的公众号SpaceObj 领取idea系列激活码

module.exports = {
publicPath: './',
devServer: {
proxy: {
//配置跨域
'/api': {
target: 'http:/IP:端口号',
changOrigin: true, //允许跨域
pathRewrite: {
'^/api': ''
}
}
}
}
}
