html2canvas 截屏 兼容手机端
<template> <div> <!--<input type="button" id="btnsavaImg" value="检测" @click="check()"/>--> <input type="button" value="检测" @click="check()" style="width: 50px;height: 30px;background-color: red;color: white"/> <img src="~static/casino_s.png" id="btnsavaImg" alt=""> <hr size="10"> <div id="imgBox" style="margin-top: 100px"> </div> </div> </template> <script> // npm install html2canvas import html2canvas from 'html2canvas'; export default { data () { return { } }, methods:{ check(){ html2canvas(document.querySelector("#btnsavaImg")).then(function(canvas) { document.querySelector('#imgBox').appendChild(canvas); }); } }, mounted () { $loading.hide(); } } </script>
https://html2canvas.hertzen.com/