getData(){

var promise1 = new Promise(function(resolve, reject) {

let params = {xmlnode:"orderType"}

transformApi(params).then(data => {

resolve(data.Data);

})

});

var promise2 = new Promise(function(resolve, reject) {

let params1 = {xmlnode:"orderState"}

transformApi(params1).then(data => {

resolve(data.Data);

})

 

});

var promise3 = new Promise(function(resolve, reject) {

var uid = localStorage.getItem('uid');

let page= 0;

let size = 10;

let search='';

let id='handled';

let params={

limit: page+'-'+size,

uid: uid,

search: search,

id : id

};

orderListApi(params).then(data => {

resolve(data.Data.items);

})

 

});

 

Promise.all([promise1, promise2,promise3]).then(values=> {

console.log(values);//[1, 2, 3]

 

values[2].forEach(ele => {

console.log(ele)

ele.type = values[0][ele.type]

ele.state = values[1][ele.state]

});

console.log(values[2])

this.list = values[2]

 

}).catch(function(values) {

console.log(values);

});

}

Logo

前往低代码交流专区

更多推荐