You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script><script>// capture, transform to image and download-btndocument.getElementById('download-btn').addEventListener('click',function(){html2canvas(document.getElementById('capture-area')).then(function(canvas){letlink=document.createElement('a');link.href=canvas.toDataURL('image/png');link.download='yau-wechat.png';link.click();});});</script>
yau生成器很草,但是生成之后需要手动截图不是很方便。
希望添加一个功能实现一键渲染到图片并下载。下面是我的实现思路:
然后将对应的
<div>
设置为#capture-area
,添加一个#download-btn
就行。完整代码如下,可以直接替换(仓库有太多无关内容不想fork就不pl了)。
望采纳。
The text was updated successfully, but these errors were encountered: