(vue)定时器

作者: rightmost | 来源:发表于2018-09-21 09:36 被阅读0次

1.创建定时器

(1)只会被调用一次

this.timer = setTimeout(() => {

 //在这里实现事件

  }, 3000)

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

this.timer = setInterval(() => {

   //在这里实现事件

},5000)

2.释放定时器

(1)

clearTimeout(this.timer)

(2)

clearInterval(this.timer)

相关文章

网友评论

    本文标题:(vue)定时器

    本文链接:https://www.haomeiwen.com/subject/axfanftx.html