//下载网络图片
    saveHttpImg(url){
    let _t = this;
       uni.downloadFile({
                        url:url, //仅为示例,并非真实的资源
                        success: (res) => {
                                if (res.statusCode === 200) {
                                        let file = res.tempFilePath;
                                        _t.save(file)
                                }
                        }
                });
            },
//保存图片到本地
            save(url){
              let _this = this;
                _this.$util._loading("保存中...");
                uni.saveImageToPhotosAlbum({
                    filePath: url,
                    success: () => {
                        uni.hideLoading();
                        _this.$util._toast("图片已保存");
                    },
                    fail: () => {
                        uni.hideLoading();
                        _this.$util._toast("保存失败");
                    },
                    complete: () => {
                    
                    }
                });
          },

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-07
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
  • 2021-06-25
  • 2021-11-18
  • 2022-02-07
相关资源
相似解决方案