遍历发起异步请求,对所有异步结果进行链式封装--Promise.all()


1.遍历结果发起异步 uploadImg(){   this.fileList.forEach(item=>{   let suffix=item.name.substring(item.name.lastIndexOf('.'))   promiseArr.push(fileServeAPI.uploadFile(this.$util.uuid()+suffix, item, 'base', this.userInfo.id).then(res=>{       return res     }))   })   return Promise.all(promiseArr).then(res=>{     this.form.photos=res.join(',')     return '1'   }) } 2.链式调用 this.uploadImg().then(res=>{}) res:['1','1']//为1中return结果          
js