zoukankan      html  css  js  c++  java
  • 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,消除恐惧的最好办法就是面对恐惧,加油奥利给!!!
     
  • 相关阅读:
    自定义ProgressBar
    Anroid开发中常用快捷键
    Intent用法
    IO(Input Output)流
    自定义Dialog
    仿UC点击两次返回键退出程序
    横竖屏切换时Activity的生命周期
    单例模式
    Timer用法
    关于数组
  • 原文地址:https://www.cnblogs.com/lq2333/p/12172125.html
Copyright © 2011-2022 走看看