1,在manifest.json新增
"h5" : {
"devServer" : {
"disableHostCheck" : true,
"proxy" : {
"/api" : {
"target" : "http://192.192.192.183:9798",
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {
"^/api" : "/"
}
}
}
}
}
2,请求接口时api代替源地址
getList(index) {
// api等价于http://192.192.192.183:9798
this.$request('/api/eurekamedicalsystem/v2/medical-emrquality/seconditem', {
// 传参参数名:参数值,如果没有,就不需要传
"wardCode": index,
// "key": this.searchValue
}).then(res => {
// 打印调用成功回调
console.log(res)
this.datalist = res;
})
},
网友评论