节流函数

    //节流函数
    throttle(val) {
      //保持this的指向始终指向vue实例
      var that = this;
      clearTimeout(this.timeout); // 每当用户输入的时候把前一个 setTimeout clear 掉
      this.timeout = setTimeout(() => {
        that.serchZZJG(val);
      }, 800);
    },

  

posted @ 2021-11-30 11:44  吃鸡小能手  阅读(32)  评论(0编辑  收藏  举报