有两种情况:
一,有统一的项目名
config下index.js
配置如下:
proxyTable: {
'/tbt_user':{
target: 'http://47.98.216.251:80', //测试线
changeOrigin: true, // 是否跨域
pathRewrite: {
'^/tbt_user': '/tbt_user'
}
}
this.$axios.post('/tbt_user/third/pay/query').then((response) => {
console.log(response)
}).catch(err => {
console.log('err')
console.log(err)
})
二,没有统一项目名
proxyTable: {
'/api':{
target: 'http://47.94.142.215:8082', // 测试
changeOrigin: true, // 改变源(是否跨域)
pathRewrite: {
'^/api': '/'
}
}
}
页面调用:
this.$axios.post('/api/third/pay/query').then((response) => {
console.log(response)
}).catch(err => {
console.log('err')
console.log(err)
})
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)