html2canvas(document.querySelector("#capture"), {
useCORS: true,
allowTaint: false,
height: domObj.offsetHeight,
width: domObj.offsetWidth,
windowWidth: document.body.scrollWidth,
windowHeight: document.body.scrollHeight,
logging: false,
x: 0, //
y: 0, // 不设置会出现页面滑动后图片上方有白框
scrollY:0, //安卓不设置会出现页面滑动后图片上方有白框
letterRendering: true,
}).then(canvas => {
let imgData = canvas.toDataURL();\\截取图片base64格式
console.log(imgData)
});
}
html2canvas使用
最新推荐文章于 2024-08-20 11:35:04 发布