<template>
    <section>
      <h1>hello world~</h1>
    </section>
  </template>
  <script>
    export default {
      data() {
        return {
          timer: '',
          value: 0
        };
      },
      methods: {
        get() {
         
          console.log('你好');
        }
      },
      mounted() {
          // 每隔5s发送一次
        this.timer = setInterval(this.get, 5000);
      },
      beforeDestroy() {
        clearInterval(this.timer);
      }
    };
  </script>

  

相关文章:

  • 2021-12-30
  • 2021-10-17
  • 2021-12-15
  • 2021-12-02
  • 2021-11-30
  • 2021-12-27
  • 2022-02-08
  • 2021-12-21
猜你喜欢
  • 2021-05-04
  • 2022-12-23
  • 2022-03-07
  • 2022-01-14
  • 2021-11-06
  • 2021-08-04
  • 2021-10-04
相关资源
相似解决方案