想要访问http://localhost:8080/change/detail/123时调用http://localhost:5438/api/change?id=123获取数据,目前配置如下:assetsPublicPath: '/',proxyTable: { '/api': { target: 'http://127.0.0.1:5438/api/', changeOrigin: true, pathRewrite: { '^/api': ''
}
}
},路由配置如下{ path: '/change/detail/:id',
name: 'ChangeDetail',
component: ChangeDetail
}ChangeDetail中代码如下this.$axios.get('api/change?id=' + id)
.then(response => {
......
})但是访问后发现axios请求的url是http://localhost:8080/change/detail/api/change?id=123 而非http://localhost:8080/api/change?id=123请问该如何配置呢?谢谢!
添加回答
举报
0/150
提交
取消