以下是我设置的代理
proxyTable: {
'/api': {
target: 'http://192.168.2.12:8980/',//设置你调用的接口域名和端口号 别忘了加http
changeOrigin: true,
pathRewrite: {
'^/api': ''//这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add’即可
}
},
下面是我的ajax调用的接口:$ajax修改了原生链Vue.prototype.$ajax = axios
this.$ajax.get('/api/axis2/services/otherExpenseListQueryOfficial.otherExpenseListQueryOfficialHttpSoap12Endpoint/getQuery', {
params: {
applier: _this.applier,
number: _this.number,
agency:_this.agency,
status:_this.status,
order:'',
page:1,
pageSize:_this.pageSize
}
})
控制台报错: [HPM] Error occurred while trying to proxy request /axis2/services/oth