import html2canvas from "html2canvas";
createImg() {
let content = this.$refs.content;
let scrollHeight = content.scrollHeight;
let scrollWidth = content.scrollWidth;
html2canvas(content, {
scale: window.devicePixelRatio * 2,
useCORS: true, //开启跨域配置,但和allowTaint不能共存
width: scrollWidth,
height: scrollHeight,
windowWidth: scrollWidth,
windowHeight: scrollHeight,
x: 0,
y: window.pageYOffset,
}).then((canvas) => {
let dataURL = canvas.toDataURL("image/png");
// let link = document.createElement("a");
// link.href = dataURL;
console.log(dataURL);
callNativeMethod("takeScreenShotImg", dataURL);
// let filename = `${new Date().getTime()}.jpg`; //文件名称
// link.setAttribute("download", filename);
// link.style.display = "none"; //a标签隐藏
// document.body.appendChild(link);
// link.click();
});
},