js:
saveImage1() {
var that = this;
wx.showLoading({
title: '保存中...',
mask: true,
});
wx.downloadFile({
url:that.data.img,//图片路径
success: function(res) {
if (res.statusCode === 200) {
let img = res.tempFilePath;
wx.saveImageToPhotosAlbum({
filePath: img,
success(res) {
wx.showToast({
title: '保存成功',
icon: 'success',
duration: 2000
});
},
fail(res) {
wx.showToast({
title: '保存失败',
icon: 'success',
duration: 2000
});
}
});
}
}
});
},