Configure the height of the generated canvas as follows , but the height of the actual generated canvas is the pixel height of the screen. I don't know why. Width also does not take effect
var opts = {
logging: true,
useCORS: true,
height:500,
};
html2canvas(dom, opts).then(canvas =>{
...
})