画布清空:
1、canvas高度或宽度被重设时,画布内容就会被清空
clearCanvas(){
this.board = this.canvas.getContext("2d");
this.canvas.height = this.canvas.height;
}
2、 使用clearRect方法
this.board = this.canvas.getContext("2d");
clean() {
this.board.clearRect(0, 0, this.canvas.width, this.canvas.height);
},
3、使用颜色填充清空画布