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


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,消除恐惧的最好办法就是面对恐惧,加油奥利给!!!
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM