我使用此脚本进行了以下设置:
<script type="text/javascript">
window.takeScreenShot = function() {
html2canvas(document.getElementById("masterslider"), {
onrendered: function (canvas) {
document.body.appendChild(canvas);
},
width:null,
height:null,
allowTaint:true
});
}
</script>
最新版本发布后,我不知道在哪里放置选项(宽度、高度、污点):
<script type="text/javascript">
window.takeScreenShot = function() {
html2canvas(document.getElementById("masterslider")).then(function(canvas) {
document.body.appendChild(canvas);
});
}
</script>
你能帮我看看在哪里放置选项吗?
最佳答案
看看html2canvas documentation.在那里,它说 html2canvas 被称为 html2canvas(element, options)
所以你的新代码应该如下所示:
<script type="text/javascript">
window.takeScreenShot = function () {
html2canvas(document.getElementById("masterslider"), {
onrendered: function (canvas) {
document.body.appendChild(canvas);
},
width: null,
height: null,
allowTaint: true
}).then(function (canvas) {
document.body.appendChild(canvas);
});
}
</script>
关于javascript - Html2Canvas alpha5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47962245/