<el-button @click="debounceSearch">debounceSearch</el-button>
import * as _ from 'lodash'
methods: {
search(e) {
// do something
},
// 这儿不能使用 箭头函数, this 会为 undefined
debounceSearch: _.debounce(function (e) {
this.search(e)
}, 1000),
}
lodash + vue + 防抖/节流 (临时笔记)
最新推荐文章于 2024-04-21 02:48:42 发布