uniapp截屏

var ws=null;
ws=this.$mp.page.$getAppWebview();
var bitmap=null;
bitmap = new plus.nativeObj.Bitmap('test');
// 将webview内容绘制到Bitmap对象中
uni.showLoading({
// title: '加载中'
});
ws.draw(bitmap,function(){
var bitmaps=plus.nativeObj.Bitmap.getItems();;
bitmap.save( "_doc/a.jpg",{},function(i){
uni.saveImageToPhotosAlbum({
filePath: i.target,
success: function () {
bitmap.clear();
setTimeout(()=>{
uni.hideLoading();
uni.showToast({
title: "截屏成功",
icon: "none"
});
},2000)
},
})
} ,
function(e){
console.log('保存图片失败:'+JSON.stringify(e));
});
},function(e){
console.log('截屏绘制图片失败:'+JSON.stringify(e));
},{check:true, // 设置为检测白屏
clip:{top:'0',left:'0',height:'100%','100%'} //设置截屏区域
});