allowTaint false Whether to allow cross-origin images to taint the canvas 默认是false
代码语言:javascript复制 <div id="capture" >
<h4 style="color: #000; ">Hello world!</h4>
<img src="http://thirdwx.qlogo.cn/mmopen/H1d1jwBqG4QzZf8kHtJ5LLer7bCvBJ1aDbOFrFuhCibQTlhhDNicxjWXXRbGN49jUiaicmDrc1icGp7YdENUvicogsf4wIHrDOcAV7/132">
</div>
代码语言:javascript复制html2canvas(document.querySelector("#capture"),{allowTaint:true}).then(canvas => {
document.body.appendChild(canvas)
});