小游戏new出来的对象如何销毁?
发布于 5 年前 作者 gang61 12062 次浏览 来自 问答

class a {
constructor() {
canvas.addEventListener(‘touchstart’, ((e) => {
e.preventDefault()

  console.log(1);
  
}).bind(this))

}

}
wx.onShow(function(){
new a;
})

运行后,发现触摸仍被侦听,按道理来讲,new之后无变量保存对象,对象就自动销毁了.
如何破?

回到顶部