axios 的使用方法
axios是一个基于promise的HTTP库, 可以再浏览器和node.js中使用 浏览器的兼容 安装 使用npm安装 npm install axios --save 使用bower安装 bower install axios --save 使用cdn引入 <script src="https://unpkg.com/axios/dist/axios.min.js"></script> 使用实例 执行get请求 // 为给定 ID 的 user 创建请求 axios.get('/user?ID=12345') .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }); // 可选地,上面的请求可以这样做 axios.get('/user', { params: { ID: 12345 } }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }); 执行post请求 axios.post('/user', { firstName: 'Fred', lastName: