vue中使用lodash的throttle不生效解决方案

 问题:

     如下使用不会执行代码,打印节流

methods: {
    throttleHandler(){
_.throttle(function () {
      console.log('节流');
      this.submit()
    }, buttonThrottle)
},

 解决:

      需要改下如下写法

methods: {
    throttleHandler: _.throttle(function () {
      console.log('截流');
      this.submit()
    }, buttonThrottle),

 

 如果觉得对你有帮助,欢迎打赏  

 

posted @ 2021-03-22 15:48  Ricardo_front  阅读(949)  评论(0编辑  收藏  举报