下載圖片
Created: Sep 29, 2020 11:16 PM
功能: 下載
async handleDownload() {
uni.showLoading({
title: "下載中"
})
// 將遠程文件下載到小程序的內存里面
const result1 = await uni.downloadFile({
url: this.imgDetail.img
})
const {tempFilePath} = result1[1]
// 將小程序的臨時文件下載到本地上
const result2 = await uni.saveImageToPhotosAlbum({
filePath: tempFilePath
})
// 提示用戶下載成功
uni.showToast({
title: "下載成功",
icon: "none"
})
}