//canvas需求是根据每个数组的显示的内容撑开canvas的高度 canvas(){ var _height = 600; //canvas的初始高度 canvas.width = screen.width; //canvas的宽度 //计算canvas的高度 for( var i=0;i<damageCar_Array.length;i++ ){ _height += 50; }; for( var i=0;i<damagePeople_Array.length;i++ ){ _height += 50; }; for( var i=0;i<damageCar_Array.length;i++ ){ _height += 50; }; canvas.height = _height; //canvas的总高度 }