NuxtN
Nuxt2y ago
MolakDul

Directive v-debounce

Hello!

I have been trying for a while to create a custom directive debounce.ts in Nuxt without success. The idea is to have an input like this:

<input
  v-model="model"
  v-debounce="500"
  @input="$emit('fieldUpdated')"
/>


And have my variable "model" updated only after 500ms. Have you ever done something like this?

PS: I know there are "easy" ways to do this, especially with lodash, but I don't want to add such a large library just for that.
Was this page helpful?