微信小程序保存图片 function

  // 保存图片
    downloadIamge(imgsrc) { // 下载图片地址和图片名
      let _this = this
      wx.getImageInfo({
        src: imgsrc,
        success: function (res) {
          wx.saveImageToPhotosAlbum({
            filePath: res.path, // 此为图片路径
            success: (res) => {
              console.log(res)
              uni.showToast({
                title: _this.$t('已经保存至相册'),
                icon: 'none'
              })
            },
            fail: (err) => {
              console.log(err)
              uni.showToast({
                title: _this.$t('图片保存失败'),
                icon: 'none'
              })
            }
          })
        }
      })
    },
原文地址:https://www.cnblogs.com/tommymarc/p/14894450.html