第一种写法
getNewFile() {
return this.request
.httpPostJson(this.$API.FILE_LIST, {
moduleId: "xxx,
phaseCode: "xxx"
})
.then(res => {
//resolve(res);
console.log(res);
})
.then(res => {
this.request
.httpPostJson(this.$API.FILE_LIST, {
moduleId: "J64fGfnI-cgbj",
phaseCode: "BtfM71CO-bjhdnr",
itemIds: [this.$route.query.actId]
})
.then(res => {
console.log("2222");
});
});
}
第二种写法
Promise.all([
new Promise(resolve => {
resolve('aaa')
}),
new Promise(resolve => {
resolve('bbb')
})
]).then(res => {
console.log(res)
})
参考文章:promise处理多个异步请求的用法