vue使用html2canvas截图空白问题
当页面出现滚动条时,会出现截图空白,即截图有偏移百度了很多解决方案,但是都不行。一次偶然看到一位大佬的试了一下可以,但是我再往回找找不到那个大佬的文章了,如果大佬看到,觉得冒犯了可联系我删除。npm install html2canvas --saveimport html2canvas from "html2canvas";let myBox = this.$refs.sav...
·
当页面出现滚动条时,会出现截图空白,即截图有偏移
百度了很多解决方案,但是都不行。一次偶然看到一位大佬的试了一下可以,但是我再往回找找不到那个大佬的文章了,如果大佬看到,觉得冒犯了可联系我删除。
npm install html2canvas --save
import html2canvas from "html2canvas";
let myBox = this.$refs.saveBox;
html2canvas(myBox, {
useCORS: true,
width: window.screen.availWidth,
height: window.screen.availHeight,
windowWidth: document.body.scrollWidth,
windowHeight: document.body.scrollHeight,
x:0,
y:window.pageYOffset
}).then(function(canvas) {
let data = canvas.toDataURL("image/jpeg", 1);
console.log(data)
});
更多推荐
已为社区贡献1条内容
所有评论(0)