shareBtn() {
let that = this
this.show = false
setTimeout(()=>{
//#ifndef H5
var pages = getCurrentPages();
var page = pages[pages.length - 1];
var bitmap = null;
var currentWebview = page.$getAppWebview();
bitmap = new plus.nativeObj.Bitmap('amway_img');
// 将web内容绘制到Bitmap对象中
currentWebview.draw(
bitmap,
function() {
bitmap.save(
'_doc/a.jpg', {},
function(i) {
uni.saveImageToPhotosAlbum({
filePath: i.target,
success: function() {
bitmap.clear();
uni.showToast({
title: '保存图片成功',
icon:'none',
mask: false,
duration: 1500
});
that.show = true
}
});
},
function(e) {
that.show = true
// console.log('保存失败', + JSON.stringify(e))
}
);
},
function(e) {
that.show = true
// console.log('截屏失败', JSON.stringify(e))
}
);
//#endif
},500)
}
Tips:不支持小程序端。