版权声明:转载的时候提到我就行…… https://blog.csdn.net/SakuraLLj/article/details/80263494
canvas.style.width = width + "px";
canvas.style.height = height + "px";
canvas.height = height * window.devicePixelRatio;
canvas.width = width * window.devicePixelRatio;
ctx.scale(window.devicePixelRatio, window.devicePixelRatio);