lodash防抖

import _ from "lodash";
const infoBoxDebounce = _.debounce(fc => fc(), 500, { leading: true });

//方法
clickMethod(){
  infoBoxDebounce(()=>{
  
    //代码块
 
 })
}

<script>
import _ from 'lodash'
export default {
  methods: {
    //方法
    clickMethod:_.debounce(function(){

    //代码块

    },1000)
  }
}
</script>

<script>
import _ from 'lodash'
export default {
  methods: {
    //方法
    clickMethod:_.debounce(() => {

        //代码块

    },1000)
  }
}
</script>

lodash防抖

posted @ 2021-01-06 22:57  易函123  阅读(123)  评论(0编辑  收藏  举报