Created
July 23, 2018 06:52
-
-
Save edsion1107/39a3edb538b7f6ddfb70d067bc455a8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>demo</title> | |
<link rel="stylesheet" href="index.css"> | |
</head> | |
<body> | |
<img id="screenshot" src="" hidden> | |
<div class="shared"> | |
<div><img src="5639390841_3782b484d4_b.jpg"></div> | |
<p>端庄典雅俏姿容,<br> | |
高髻朱唇两耳丰。 | |
</p> | |
<img id="qrcode" src="Group@2x.png" hidden> | |
</div> | |
<button onclick=screenshot()>截图</button> | |
</body> | |
<script src="html2canvas.js"></script> | |
<script type="text/javascript"> | |
function screenshot() { | |
document.getElementById('qrcode').hidden = false; | |
html2canvas(document.body, {windowWidth: 960, windowHeight: 1080}).then(function (canvas) { | |
// document.body.appendChild(canvas); | |
let i = document.getElementById('screenshot'); | |
i.src = canvas.toDataURL('image/png'); | |
i.setAttribute("crossOrigin",'Anonymous'); | |
i.hidden = false; | |
}); | |
} | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment