axios执行多个请求参数

直接上代码吧

两个数据一样 通过post请求的

第一个请求的数据--------------------------

  function getUserAccount() {
  return axios({
             methods:"post",
             url: 'https://api.it120.cc/small4/user/m/login?deviceId=007&deviceName=monkey',
             params:{
                  mobile:13500000000,
                  pwd:12345
              }
  });
}
第二个请求的数据--------------------------
function getUserPermissions() {
  return axios({
             methods:"post",
            url: 'https://api.it120.cc/small4/user/m/login?deviceId=007&deviceName=monkey',
             params:{
                  mobile:13500000000,
                  pwd:12345
              }
  });
}
通过控制台打印---------------------------需要哪个数据将哪个通过console.log进行控制台打印
axios.all([getUserAccount(), getUserPermissions()])
  .then(axios.spread(function (acct, perms) {
    // 两个请求现在都执行完成
  console.log(perms)
  }));
console.dir(axios)  控制台打印发现axios的方法全部都在构造函数上。
 仅供参考谢谢。

猜你喜欢

转载自www.cnblogs.com/yangjingyang/p/11505735.html
今日推荐