现在有个需求需要批量的发送API请求,数量有点多,网页打开以后很快就提示错误了,因为同一时间发送的请求过多有一些没来及执行的就超时了。用的axios,貌似没有同步请求的方法。下面这个代码,有什么办法能让GetCombo()同步请求呢?SetComboList(fromData, toData)
{
fromData.forEach(element => {
GetCombo(element.comboID).then(response => { let result = response.data;
toData.push(result);
});
});
},
添加回答
举报
0/150
提交
取消