setInterval(() => { ... },10000);
当我离开嵌入组件的路径时,计时器不会退出.我怎样才能做到这一点?
routerOnActivate() { this.timer = setInterval(()=>{ ... },10000); } routerOnDeactivate() { clearInterval(this.timer); }