前端跨域配置

####VUE项目配置跨域

##在vue-project文件下config下的index中
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {
##在这里添加以下api
'/api':{
target: 'http://127.0.0.1:8000/',
changeOrigin: true, //改变源,
pathRewrite: {???????
'^/api': '' //路径重写?
}
}
},

猜你喜欢

转载自www.cnblogs.com/ahmy/p/12076476.html
今日推荐