屏幕截图插件html2canvas
程序员文章站
2022-07-12 19:42:30
...
首先下载html2canvas.min.js,然后调用方法
<div id="capture" style="padding: 10px; background: #f5da55">
<h4 style="color: #000; ">Hello world!</h4>
</div>
html2canvas(document.querySelector("#capture")).then(canvas => {
document.body.appendChild(canvas)
}