How to use the plug-in html2canvas? every screenshot has a different result, please.

how to use the plug-in html2canvas? each screenshot shows different results. For more information, please see the picture

. The

clipboard.png
box is the area where screenshots need to be taken. The following is the result of saving the screenshot.
here is my code. Can you take a look at it?
saveImg (imgURL) {

html2canvas(document.getElementById("div"),{useCORS: true})
.then((canvas)=>{
  console.log(canvas);
  document.body.appendChild(canvas);
  var img = canvas.toDataURL("image/png")
  this.setState({
    myImgUrl:img
  })
  
})
}

< div id="div" style= {{width:100,height:50,paddingTop:5,color:"red"}} >

fdsfdsfdsfdsf

<img src={centerImg} style={{width:30,height:20}}/>

< / div >

Mar.13,2021

Boss, has this problem been solved? Me, too.

Menu