📅  最后修改于: 2022-03-11 15:02:14.102000             🧑  作者: Mango
function loadImage(url) {
return new Promise(r => { let i = new Image(); i.onload = (() => r(i)); i.src = url; });
}
let img = await loadImage("./my/image/path.jpg");
ctx.drawImage(img, 0, 0);