• vue 项目中,定时器(setInterval)的写法:
    fetchJobList是一个方法,里面有dispatch一个action进行请求接口的代码。
    data () {
        return {
            intervalId: 0
        }
    },
    created () {
        this.fetchJobList()
        this.intervalId = setInterval(() => {
            this.fetchJobList()
        }, 5000)
    },
    beforeDestroy () {
        clearInterval(this.intervalId)
    }

相关文章:

  • 2022-12-23
  • 2022-03-06
  • 2021-12-31
  • 2022-12-23
  • 2021-12-31
  • 2022-12-23
  • 2023-03-21
猜你喜欢
  • 2021-12-31
  • 2021-05-21
  • 2022-12-23
  • 2022-01-07
  • 2021-12-31
  • 2022-12-23
  • 2023-03-19
相关资源
相似解决方案