let imageUrls = [
'https://image1.jpg',
'https://image2.jpg',
'https://image3.jpg',
// ...
];
for (let i = 0; i < imageUrls.length; i++) {
uni.downloadFile({
url: imageUrls[i],
success: (res) => {
if (res.statusCode === 200) {
uni.saveFile({
tempFilePath: res.tempFilePath,
success: (res) => {
console.log('图片已保存到:' + res.savedFilePath);
}
});
}
}
});
}
网友评论