防抖

实际开发在如果在某段时间内平凡操作,会平凡请求接口,这是我们所不想看到的情况。这时候就需要防抖 防抖可以参考 https://www.lodashjs.com/docs/latest

 

简单的防抖如下

   if (this.timer) {
     clearTimeout(this.timer)
   }
   this.timer = setTimeout(() => {
          //todo
   }, 500)

 

posted @ 2019-11-14 16:03  三高娘子  阅读(141)  评论(0编辑  收藏  举报