9秒定时器使用

阅读 178

2022-10-24

    getStock() {

      let t = 0;

      const timeOut = () => {

        //9秒定时器

        setTimeout(() => {

          this.$store.dispatch("HOME_STOCK", {}).then(() => {

            t = t || 9 * 1000;

            timeOut();

          });

        }, t);

      };

      timeOut();

    },



  // getStock() {

    //   let t = 0;

    //   const timeOut = () => {

    //     //9秒定时器

    //     setTimeout(() => {

    //       this.$store.dispatch("HOME_STOCK", {}).then(() => {

    //         t = t || 9 * 1000;

    //         timeOut();

    //       });

    //     }, t);

    //   };

    //   timeOut();

    // },


精彩评论(0)

0 0 举报