代码
function downs(url){
return new Promise(function(resolve,reject){
uni.downloadFile({
url: url,
success: function(res) {
resolve(res.tempFilePath);
}
})
})
}
var p1 = downs(url_1);
var p2 = downs(url_2)
var p3 = downs(url_3);
//单个用法
p1.then(data=>{
console.log(data)
})
//多个用法
Promise.all([p1,p2,p3]).then(data=>{
console.log(data)
})