使用html2canvas库剪切图像

时间:2020-06-17 09:32:47

标签: javascript reactjs html2canvas

我正在使用以下代码捕获画布的屏幕截图

var bodyContainerDiv = ReactDOM.findDOMNode(this.bodyContainer.current) as HTMLDivElement;
        (html2canvas as any)(bodyContainerDiv, { width: bodyContainerDiv.scrollWidth, height: bodyContainerDiv.scrollHeight }).then((canvas) => {
            var base64Image = canvas.toDataURL("image/png");
            download(base64Image);
        });

0 个答案:

没有答案