欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

全栈自培养 ---- 微信小程序实现上传保存图片-保存文件

最编程 2024-03-29 12:57:22
...
    async saveAvatar() {
      uni.downloadFile({
        url: '......',
        success: (res) => {
          if (res.statusCode === 200) {
            uni.saveImageToPhotosAlbum({
              filePath: res.tempFilePath,
              success: function () {
                uni.showToast({
                  title: "保存成功"
                });
              },
              fail: function () {
                uni.showToast({
                  title: "保存失败",
                  icon: "none"
                });
              }
            });
          }
        }
      })
    },