向后台发送请求现在的写法
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=0
this.$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
webpack-dev-server可以配置代理,
axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
axios.defaults.headers.post['content-Type'] = 'appliction/x-www-form-urlencoded';