小游戏开发
发布于 5 年前 作者 mengping 10928 次浏览 来自 问答

坐的小游戏项目,有不同页面,在一个位置都有按钮,一个页面结束后进入另一个,但是点击那个位置还是触发上页面的点击事件,清楚canvas用clrearRect不好用?

1 回复

要移除点击事件

this.startTouchEventBind = this.startTouchEventHandle.bind(this)
this.moveTouchEventBind = this.moveTouchEventHandle.bind(this)
this.endTouchEventBind = this.endTouchEventHandle.bind(this)
canvas.removeEventListener('touchstart', this.startTouchEventBind)
canvas.removeEventListener('touchmove', this.moveTouchEventBind)
canvas.removeEventListener('touchend', this.endTouchEventBind)
回到顶部