uniapp 的H5项目,左边是网页内容,右边是截图结果。 我用正常vue3项目截图都是正常的,但是这个项目不知道为什么,截出来这个玩意,谁能帮忙解答一下。
const downLoad = async () => {
console.log(document.querySelector('#capture22'));
html2canvas(document.querySelector('#capture22'), {
useCORS: false,
height: 400,
width: 750,
allowTaint: false,
}).then(canvas => {
// 将生成的 Canvas 显示在页面上
const link = document.createElement('a');
link.download = 'screenshot.png';
link.href = canvas.toDataURL('image/png');
link.click();
});
}
<div id="capture" style="padding: 10px; background: #f5da55; margin-bottom: 20px;">
<h4>Hello world!</h4>
<p>这是一个需要截图的内容区域2222ykl3333999999999。</p>
</div>
我html 用div , view 都不行。
9***@qq.com (作者)
我vue3 的,没有this吧, 你说的this是哪个this?
2025-02-17 16:15