zoukankan      html  css  js  c++  java
  • 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的方法全部都在构造函数上。
     仅供参考谢谢。
  • 相关阅读:
    11.tp5常见漏洞
    10.tp3常见漏洞
    1.linux分析排查
    3.docker镜像探究
    1.docker概述
    4.docker常用命令
    2.docker安装
    3.windows分析排查
    9.thinkphp框架模型
    2.win2k8搭建asp网站
  • 原文地址:https://www.cnblogs.com/yangjingyang/p/11505735.html
Copyright © 2011-2022 走看看