使用過兩種解決方案:
1是用原始的for循環
for(let i=0;i<_this.dataShow.length;i++){
_this.dataShow[i].MarkContent = await _this.$curl.get(_this.dataShow[i].MarkContentUrl,{contentType: "application/x-www-form-urlencoded; charset=utf-8"}); }
2堅持使用forEach,map
let newarr=await Promise.all(arr.map((e)=>{
await 請求
return **** }))
原理應該是foreach內部封裝了while,循環並行執行,而且並行執行數組的所有callback函數,不會等待里面的callback的返回。
