angular10中使用lodash的throttle方法

先引入lodash

import * as _ from ' lodash '

 

 

public   search = _.throttle(function(){

这里写自己的函数

}, 3000, {

leading: true,
    trailing: false,

})

 

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

posted on 2021-09-14 16:03  老虎念大悲咒  阅读(124)  评论(0编辑  收藏  举报