axios请求接口的方式
1)delete
删除服务器上的数据。
axios({
url: 'xxx' + id,
method: 'delete'
}).then(res=>{
console.log(res)
})
2)put
完整更新服务器上的数据(一般可用于更新用户的完整信息)。
axios({
url: 'xxx',
method: 'put',
data:{
bookname: bookname,
author: author,
publisher: publisher
}
}).then(res=>{
console.log(res);
})
3)patch
部分更新服务器上的数据(例如:只更新新用户的手机号)
axios({
url: 'xxx',
method: 'patch',
data:{
old_pwd: xxx,
new_pwd: xxx
}
}).then(res=>{
console.log(res);
})