<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>页面截图</title>
</head>

<body>
    <div id="capture" style="padding: 10px;background: #f5da55;width: 300px;height: 300px;text-align: center;">
        <h4 style="color: #000; ">Hello world!</h4>
        <!-- 图片不支持外链 -->
        <img src="/iot.svg" alt="">
    </div>
    <hr>

    <script type="text/javascript" src="http://html2canvas.hertzen.com/dist/html2canvas.js"></script>
    <script>
        html2canvas(document.querySelector("#capture")).then(canvas => {
            document.body.appendChild(canvas)
        });
    </script>
</body>

</html>
Last modification:January 12th, 2021 at 08:00 pm
如果觉得我的文章对你有用,请随意赞赏