angular10中使用lodash的throttle方法

先引入lodash

import * as _ from ' lodash '

public   search = _.throttle(function(){

这里写自己的函数

}, 3000, {

leading: true,
    trailing: false,

})

_.throttle  他本身需要返回一个函数,用他来处理节流

原文地址:https://www.cnblogs.com/rrene/p/15268040.html