saveImgToLocal: function(e) {
let me = this;
uni.showModal({
title: '提示',
content: '确定保存到相册吗',
success: function(res) {
if (res.confirm) {
uni.downloadFile({
url: me.kf.kf_img, //图片地址
success: res => {
if (res.statusCode === 200) {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function() {
uni.showToast({
title: '保存成功',
icon: 'none'
});
},
fail: function() {
uni.showToast({
title: '保存失败',
icon: 'none'
});
}
});
}
}
});
} else if (res.cancel) {
}
}
});
}
绑定长按事件
@longtap="saveImgToLocal"