您好,欢迎来到知库网。
搜索
您的当前位置:首页axios 配置代理

axios 配置代理

来源:知库网

1.在config 下的index.js内配置
proxyTable: {
'/login': {
target: '地址',
changeOrigin: true,
pathRewrite: {
'/login': ''
}
}
},
2.在请求的时候
this.$axios({
method: 'get',
baseURL: '/login',
url: 'sys/Login/login'
}).then(res => {
console.log(res);
console.log(JSON.stringify(res.data.data));
sessionStorage.setItem('res_data', res.data.data);
}).catch(
err => {
console.log(err);
}
);

Copyright © 2019- zicool.com 版权所有 湘ICP备2023022495号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务