devServer: {
open: true, //是否自动弹出浏览器页面
host: "localhost",
port: 8080,
proxy: {
'/apis': {
target: 'http://efmudc.homewell.com.cn/platformapi', // target host
ws: true, // proxy websockets
changeOrigin: true, // needed for virtual hosted sites
pathRewrite: {
'^/apis': '' // rewrite path
},
'/ipa': {
target: 'http://47.99.60.167:8081/api/test',
ws: true,
changeOrigin: true,
pathRewrite: {
'^/ipa': ''
}
}
},
}
}
axios.default.baseUrl = "/apis";
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
axios.defaults.withCredentials=true
Vue.prototype.$axios = axios;
axios.interceptors.response.use(res=>res.data);
请求的时候
let publicKey = await axios.get('/apis/getPublicKey')
网友评论