uni-app下載圖片


下載圖片

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"
      })
    }


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM