<canvas id="app" width="1000" height="500"></canvas>
let canvas = document.getElementById("app"),
ctx = canvas.getContext("2d"),
scale = window.devicePixelRatio,
canvas.style.width = canvas.width / scale + 'px';
canvas.style.height = canvas.height / scale + 'px';
如此便能解决问题,有用收藏点赞哟~