首页 > Web开发 > 详细

js ES6 Promise.all 等两个接口都返回成功执行

时间:2020-01-09 18:09:52      阅读:353      评论:0      收藏:0      [点我收藏+]
Promise.all([loanproducttype(),getloanproductlist(p)]).then((result) => {
        this.loading = false;

        //产品类型
        this.producttypes = result[0].jbody.loanProductTypes;
        console.log(this.producttypes);
        for(var i= 0;i<this.producttypes.length;i++){
          this.productTypeNameKV[this.producttypes[i].productType] = this.producttypes[i].productTypeName;
        }

        //表格数据
        this.data1 = result[1].jbody.pageInfo.list;
        this.total1 = result[1].jbody.pageInfo.total;
              
        }).catch((error) => {
          this.loading = false;

        console.log(error)
 })
loanproducttype()是请求产品类型 的方法,result[0] 是该接口的返回值。
getloanproductlist(p) 是表格数据的方法,result[1] 是该接口的返回值。
我们遇到什么困难,也不要怕,微笑着面对Ta,消除恐惧的最好办法就是面对恐惧,加油奥利给!!!
 

js ES6 Promise.all 等两个接口都返回成功执行

原文:https://www.cnblogs.com/lq2333/p/12172125.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!