html
<image :src="qrcodeImg" @longtap="shareImg"></image>
js
shareImg() {
let _this = this
let ws = this.$mp.page.$getAppWebview();
let bitmap = new plus.nativeObj.Bitmap();
this.$nextTick(function(){
setTimeout(()=>{
ws.draw(bitmap,(e)=>{
console.log('bitmap绘制图片成功');
console.log("e: " + JSON.stringify(e));
bitmap.save("my.jpg", {
overwrite: true,
quality: 100
}, (i)=>{
plus.gallery.save(i.target,(e)=>{
uni.showToast({
title:'保存成功'
})
bitmap.clear(); //销毁
},(e)=>{
bitmap.clear(); //销毁
});
},(e)=>{
uni.showToast({
title:'保存失败'
})
console.log('保存图片失败:' + JSON.stringify(e));
});
},(e)=>{
uni.showToast({
title:'绘制图片失败'
})
console.log('bitmap绘制图片失败:'+JSON.stringify(e));
});
},200)
})
}