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
importdomtoimagefrom'dom-to-image';varnode=document.getElementById('my-node');domtoimage.toPng(node).then(function(dataUrl){varimg=newImage();img.src=dataUrl;document.body.appendChild(img);}).catch(function(error){console.error('oops, something went wrong!',error);});
介绍
正如官网所描述的那样:dom-to-image 可以将任意dom节点转换为用JavaScript编写的矢量(SVG)或(PNG或JPEG)图像。
使用
关于失真问题的处理
生成后的图片可以 ,设置宽度100%,这样不会出现滚动的情况
The text was updated successfully, but these errors were encountered: