downloadImg() {
wx.downloadFile({
url: `${this.img_Url}/home_top.png`,//自己的图片的地址
success: function (res) {
console.log(res, 1)
const tempFilePath = res.tempFilePath //通过res中的tempFilePath 得到需要下载的图片地址
wx.saveImageToPhotosAlbum({
filePath: tempFilePath, //设置下载图片的地址
success: function (res) {
uni.showToast({
title: "下载成功,已保存到相册",
icon: "none",
});
}
})
},
fail: function (err) {
uni.showToast({
title: "下载失败",
icon: "none",
});
}
})
},
微信小程序下载图片
最新推荐文章于 2024-06-17 14:49:43 发布