1. 程式人生 > >axios 簡單方法個人理解

axios 簡單方法個人理解

get perm pkg ons catch script zha nbsp name

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 " } })

axios 簡單方法個人理解