proxyTable: {
'/api': {
target: 'http://localhost:8080',
pathRewrite: {
'^/api': '/static/mock'
}
}
},
methods: {
getHomeInfo() {
axios.get("/api/index.json").then(this.getHomeInfoSucc); //
},
getHomeInfoSucc(res) {
console.log(res);
}
},

本文介绍了一种在本地开发环境中配置代理的方法,通过将请求重定向到特定的URL,实现跨域请求。同时,展示了如何使用axios进行API调用,并处理响应数据。
877

被折叠的 条评论
为什么被折叠?



