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 " } })
原文地址:https://www.cnblogs.com/GongYaLei/p/8782157.html
时间: 2024-11-05 21:12:31