Article From:https://www.cnblogs.com/lvye001/p/9968737.html

getrequest

1 on_sum: function () {
2     axios.get('http://127.0.0.1:8000/test/'
3     ).then(response=>{
4         alert('ok')
5     }).catch(error=>{
6         alert(error)
7     })
8 }

postrequest

 1 on_sum: function () {
 2     axios.post('http://127.0.0.1:8000/test/',
 3         {'key':'value'
 4       ......
 5         }).then(response=>{
 6 
 7     }).catch(error=>{
 8 
 9     })
10 }

axios API

on_sum: function (){
axios({
method:'post',
url:'/test/',
data:{
firstName: 'Fred',
lastName: 'Flintstone'
}
}).then(response=>{
  pass
}).error(error=>{
      pass
})
},

Aliases for request methods

For convenience, aliases are provided for all supported request methods

  1. axios.request(config)
  2. axios.get(url[, config])
  3. axios.delete(url[, config])
  4. axios.head(url[, config])
  5. axios.post(url[, data[, config]])
  6. axios.put(url[, data[, config]])
  7. axios.patch(url[, data[, config]])

 

Link of this Article: Axios instructions for use

Leave a Reply

Your email address will not be published. Required fields are marked *