<div ref="imageWrapper">
<div>출력하고 싶은 것</div>
</div>
<button @click="takeScreenshot('result')">출력하기</button>
const imageWrapper = ref(null) as any;
const takeScreenshot = (id: string) => {
html2canvas(imageWrapper.value, {
logging: false,
allowTaint: true,
scale: window.devicePixelRatio,
// width: shareContent.clientWidth,
// height: shareContent.clientHeight,
scrollY: 0,
scrollX: 0,
useCORS: true,
backgroundColor: '#ffffff',
}).then((canvas) => {
const imgUrl = canvas.toDataURL('image/png');
const tempLink = document.createElement('a');
tempLink.href = imgUrl;
tempLink.setAttribute('download', id);
document.body.appendChild(tempLink);
tempLink.click();
document.body.removeChild(tempLink);
window.URL.revokeObjectURL(imgUrl);
});
};