html2canvas html2canvas中文文档

JavaScript截图工具

HTML

<div id="capture" style="padding: 10px; background: #f5da55">
    <h4 style="color: #000; ">Hello world!</h4>
</div>

JavaScript

html2canvas(document.querySelector("#capture")).then(canvas => {
    document.body.appendChild(canvas)
});