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"
      })
    }
posted @ 2020-10-02 23:24  彼_岸  阅读(757)  评论(0编辑  收藏  举报