步骤一:配置代理
image.png
步骤二:请求
import axios from 'axios';
export default {
data() {
return {
};
},
methods: {
proxyRequest() {
let instance = axios.create({});
instance({
method: "post",
url: '/customer_phone',
data: {},
baseURL: '/zbapi',
headers: {
'Api-Version': 'v308',
'Token': 'ea165a4a2566797917ee60aa53ef72288f9f7e5b12d0b64b674ab9e6995c63e3',
},
timeout: 120000 // 37秒超时时间
})
.then(response => {
console.log("代理----", response);
})
.catch(error => {
setTimeout(this.toastHide, 0);
this.frequentlyToastShow = false;
console.log("异常了eeeeeeeeeeee", error);
});
}
},
};
网友评论