妹纸图:微信API打开图片长按保存图片实例,定义几个数组用来存取item中的数据,主要是引入utils包下的js文件,将获得的各种数据写入itemList,用于setData,绑定接口中返回的数据,保存图片请参见以下代码:   function saveImage(mUrl) {   that.setData({    hidden: false,    toastHidden: true,    modalHidden: true,    loadingText: "下载中..."   });   wx.downloadFile({    url: mUrl,    type: 'image',    success: function (res) {    console.log("download success");    that.setData({    hidden: true,    toastHidden: false,    toastText: "恭喜你,图片保存成功"    });    },    fail: function (res) {    console.log("download fail");    that.setData({    hidden: true,    toastHidden: false,    toastText: "保存失败,请稍后再试"    });    },    complete: function (res) {    console.log("download complete");    }   })   }
2022-08-16 03:39:28 8.88MB 微信源码-相册图库
1