如何在 nuxt.js 中使用 lodash.debounce?

问题描述

我正在尝试在我的 nuxt.js 项目中使用 lodash.debounce,但我正在为此苦苦挣扎。

我无法重现 Vue 示例,也找不到适用于 Nuxt.js 的示例,所以我想知道我是否遗漏了更大的内容。我应该只使用超时,例如 this example here

解决方法

Vue2 已经有一些具有 debounce 属性的对象,但它什么也不做。 Vue3 是从头开始编写的,将会有去抖动。

所以可能没有为 Nuxtjs 做好准备,我使用了 clear timeout / set timeout 策略,就像示例一样,效果很好。