//get请求
axios.get('请求地址', {
params: {
//请求数据
},
headers:{
token:"token"
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
//post请求
axios.post('请求地址', {
// 请求数据
},
{
headers:{token:"token"}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
// 发送 POST 请求
axios({
method: 'post',//请求类型
url: '请求地址',
headers:{
token:"token"
},
data: {
//请求数据
}
})
.then(function(res){
console.log(res)
})
.catch(function(err){
console.log(err)
})
axios
最新推荐文章于 2022-10-22 20:06:45 发布