axios --笔记
btn.onclick = function(){
axios({
method:'GET',
url: 'http://localhost:3000/'
}).then(response){
console.log(response)
}
}
btn.onclick = function(){
axios({
method: 'POST',
url: 'http://localhost:3000/posts',
data: {
....
},
}).then(response){
console.log(response)
}
}
btn.onclick = function(){
axios({
method: 'PUT',
url: 'http://localhost:3000/posts/3',
data: {
....
},
}).then(response){
console.log(response)
}
}
btn.onclick = function(){
axios({
method: 'DELETE',
url: 'http://localhost:3000/posts/3'
}).then(response){
console.log(response)
}
}
btn.click = function(){
axios({
method: '具体类型',
url: '',
baseURL: '',
transformRequest:
transformRequest:
headers:
params: {},
timeout:
......
})
}
axios.defaults.baseURL = '....'