这里给大家推荐一款免费迭代 二开便捷的商城项目:源码直通车>>>
我之前有篇博客谈论过vue调用接口,会出现跨域的问题
https://blog.csdn.net/fate_sky8521/article/details/89948841
根据之前配置可以调用接口了,但是会有一个新的问题
http://localhost:8080/classfy/apis/index/category/getGoos 404 not found
src/router/index.js配置如下
解决方法:
修改配置config/index.js 如下
proxyTable: {
'/api/**': {
// 测试环境
target: 'http://myshop.com', // 接口域名
changeOrigin: true, //是否跨域
pathRewrite: {
'^/apis': '/' //需要rewrite重写的,
}
}
}
调用接口时: