日日行,不怕千万里

axios 简单方法个人理解

1、手动下载  axios 方式  npm install axios  ||  <script  src="https://unpkg.com/axios/dis/axios.min.js"></script >

2、bower  install axios   

3、  import axios from "axios";

    1、 axios.get( ' url ' ).then((response)  =>  console.log(response) ).catch((error) => console.log(err));

  2、axios.post( ' url ' ).then((response) => console.log(response)).catch((err) => console.log(err));

  3、const demo1 = () => { retrun axios.get('  app/userName ') };   const demo2 = () => { retrun axios.get('  app/userName ') }; 

  axios.all([demo1(), demo2()]).then((acct, perms)   =>   console.log(acct, perms)) 

  4、axios({  method: ' post ' ,   url :  "  /user/list ",    data:  {  fistName:  " zhangsan ",  age:  "  18 " }  })

posted @ 2018-04-10 19:57  GongXiaoZhu  阅读(202)  评论(0编辑  收藏  举报