原文链接:https://www.hebaocun.com/blog/97.html
var bitmap = new plus.nativeObj.Bitmap();
// 加载海报图片
bitmap.loadBase64Data(_this.poster, function() {
//保存到系统相册
bitmap.save("doc/poster"+_this.coupon.item_id+".jpg", {
overwrite: true, //是否覆盖已有图片, true 是
quality: 100 //图片质量,1-100 默认50, 100质量最高
}, function(e) {
//重点就是这里, 需要将bitmap保存的临时路径再使用saveImageToPhotosAlbum进行保存
uni.saveImageToPhotosAlbum({
filePath: e.target,
success: function () {
uni.showToast({
title: "图片保存成功",
icon: "none"
});
}
});
}, function(e) {
uni.showToast({
title: "图片保存失败",
icon: "none"
});
});
}, function(e) {
uni.showToast({
title: "图片保存失败",
icon: "none"
});
});
12 个评论
要回复文章请先登录或注册
6***@qq.com (作者)
z***@qq.com