async,await,promise.all(),实现同时异步请求多个接口,等待接口全部返回后,统一处理数据
async asyncDemo(){
const [
fileLists4_1,
fileLists4_2,
fileLists4_3,
fileLists4_4,
fileLists4_5,
fileLists4_6,
] = await Promise.all([
this.imageQry({
aa: "1",
}),
this.imageQry({
aa: "2",
}),
this.imageQry({
aa: "3",
}),
this.imageQry({
aa: "4",
}),
this.imageQry({
aa: "5",
}),
this.imageQry({
aa: "6",
}),
]);
},
async imageQry(data) {
let upData = {
aa: data.aa,
};
let res = await request({
url: "/xxxxx/xxxxx",
method: "post",
data: upData,
jsonBool: false,
retAll: true,
});
return [];
},