Home > Mobile >  WeChat small program to upload more photo Promise. All didn't be triggered
WeChat small program to upload more photo Promise. All didn't be triggered

Time:03-05

I use WeChat small program to upload photos, such as upload two
After the two photos uploaded to determine the pop-up display
Below is the code, the result is that two images to be uploaded to the cloud, but Promise. All were not triggered
Seek advice, thank you
 
Let promiseArr=[];
For (the let I=0; I & lt; This. Data. ImgUploadMax; I++) {
Let promise=new promise ((reslove, reject)=& gt; {
Let the item=this. Data. Files [I];
Let ext=item. Match (1/\ [^.] +? $/) [0];
Let eventTile=data [' title '];
Let time=(new Date ()). The getTime ();
Let rand=parseInt (Math. The random () * 100000);
Let cloudPath=` img_ $${time} {eventTile} _ _ ${rand} ${ext} `;
Wx. Cloud. UploadFile ({
CloudPath: cloudPath,
FilePath: item,
Success: res=& gt; {
Resolve (res);//be triggered two here
},
Fail: e=& gt; {
Reject (e);
},
Complete: the function () {

}
});
});
PromiseArr. Push (promise);
}
Promise. All (promiseArr). Then ((result)=& gt; {
//to return the result array processing
debugger;//there is no trigger
})

CodePudding user response:

Done on my own
  • Related