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