2019.11.25

(vue)定时器

2018-09-21  本文已影响0人  rightmost

1.创建定时器

(1)只会被调用一次

this.timer = setTimeout(() => {

 //在这里实现事件

  }, 3000)

(2)每隔N秒被调用一次

this.timer = setInterval(() => {

   //在这里实现事件

},5000)

2.释放定时器

(1)

clearTimeout(this.timer)

(2)

clearInterval(this.timer)

上一篇 下一篇

猜你喜欢

热点阅读