Skip to content

Instantly share code, notes, and snippets.

@markshust
Created December 3, 2023 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markshust/ae671cd7a0f93033f01a2e2883b1b3c6 to your computer and use it in GitHub Desktop.
Save markshust/ae671cd7a0f93033f01a2e2883b1b3c6 to your computer and use it in GitHub Desktop.
Nuxt Content VueJS v2 Debounce Input
<template>
<div>
<input
type="text"
placeholder="Search"
@input="debounceSearch()"
v-model="search"
/>
</div>
</template>
<script>
export default {
data() {
return {
search: '',
}
},
methods: {
triggerSearch() {
alert(this.search);
},
debounceSearch: function() {
if (this.debounceTimeout) clearTimeout(this.debounceTimeout);
this.debounceTimeout = setTimeout(() => {
this.filterBlog();
}, 500);
}
}
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment