【发布时间】:2019-01-27 12:11:59
【问题描述】:
我尝试在方法上使用 lodash 进行去抖动。
我的意见:
<el-input
placeholder="Search poeples"
suffix-icon="el-icon-search"
@input="debounceGetPoeples"
v-model="keywords">
</el-input>
我在方法中的反跳:
debounceGetPoeples: debounce(() => {
console.log('Debounce ok');
this.getPoeples();
}, 500),
去抖动功能正常,但是当我在视图组件_this2.getPoeples is not a function中调用另一个方法时出现错误@
我尝试为我的 debounce 做一个正常的功能,但是当我这样做时,它被忽略了
debounceGetAnimals() {
return debounce(() => {
console.log('debounce ok');
this.getPoeples();
}, 300)
}
如何让我的 debounce 工作并在里面调用另一个方法?
非常感谢您的帮助
【问题讨论】:
标签: javascript vuejs2