向后台发送请求现在的写法this.$http.get('http://1.1.1.1:8080/product/getAllProducts?page=0').then((response)=>{me.tableData=response.body.data.content}).catch(function(response){/***todo:此处待补充错误处理**/})我希望改成下面写法但是效果还是http://1.1.1.1:8080/product/getAllProducts?page=0this.$http.get('product/getAllProducts?page=0').then((response)=>{me.tableData=response.body.data.content}).catch(function(response){/***todo:此处待补充错误处理**/})为此,我改了config/index.js文件中的dev:{proxyTable:{'/api':{target:'http://1.1.1.1:8080',changeOrigin:true}}但是并不能实现我想要的效果,求助求助注意:我用的是vue-resource,怎么写呢?而且我就是开发模式下请求需要指定地址,在build模式下正常使用localhost
2 回答

沧海一幻觉
TA贡献1824条经验 获得超5个赞
this.$http.get('product/getAllProducts?page=0')请求前面少了一个'/',改成this.$http.get('/product/getAllProducts?page=0'),其实可以控制台调试一下,看看接口请求的详细信息,一步一步找原因可以找到的。
添加回答
举报
0/150
提交
取消