1、npm i lodash下载
2、在页面中引入
//指定引入节流函数(throttle:节流,debounce:防抖)
import {throttle,debounce} from 'lodash'
3、如何使用
//节流的使用(如果你频繁的触发当前函数,那么它只会在规定的时间后去执行)
show: throttle(function (index) {
this.count = index
}, 50),
//防抖的使用(如果你频繁的触发当前函数,那么它只会在规定的时间后触发,只执行一次,之前的都会过滤掉)
show: debounce(function (index) {
this.count = index
}, 50),