vue中使用节流器

1.下载依赖

cnpm i --save lodash.throttle

2.使用

import _ from 'lodash'

export default{
 methods:{
    click:_.throttle(function(){
            console.log('hello')
            console.log(this)
    },1000)
 }
}
发布了598 篇原创文章 · 获赞 49 · 访问量 15万+

猜你喜欢

转载自blog.csdn.net/weixin_43837268/article/details/103864529