关于计时器自我清除的问题?
timer_load:function(task)
{
var that=this;
that.timer_index_task = setInterval(() => {
clearInterval(this.timer_index_task)
console.log(‘function1tofunction2=true’+task);
},3000)
}
当funaction1调用timer_load的时候3秒后执行console.log,但是当funaction1,funaction2同时调用timer_load;就会出现计时器会一直运行一直Log,不能自我清除的问题,请问怎么解决呢?