varimg =newImage();
img.id ='pic';
img.onload =function(){
cxt.drawImage(img,x,y,witdh,height);
};
解决方式:
添加到dom里面
var img = document.createElement('img');
img.src="图片地址";
varimg =newImage();
img.id ='pic';
img.onload =function(){
cxt.drawImage(img,x,y,witdh,height);
};
解决方式:
添加到dom里面
var img = document.createElement('img');
img.src="图片地址";