我正在尝试获取当前页面的屏幕截图,并使用phonegap通过Facebook,Whats App,Instagram,Twitter等进行共享。但是无法正确地做到这一点。 我尝试了这段代码,但是没有用。谁能帮我解决这个问题?
function report() {
let region = document.querySelector("body"); // whole screen
html2canvas(region, {
onrendered: function(canvas) {
let pngUrl = canvas.toDataURL();
let img = document.querySelector(".screen");
img.src = pngUrl; // pngUrl contains screenshot graphics data in url form
window.plugins.socialsharing.share(img.src);
// here you can allow user to set bug-region
// and send it with 'pngUrl' to server
},
});
}