Skip to content

Instantly share code, notes, and snippets.

@MexsonFernandes
Created October 22, 2020 10:41
Show Gist options
  • Save MexsonFernandes/d99d68160c3f256298b6d20228595f78 to your computer and use it in GitHub Desktop.
Save MexsonFernandes/d99d68160c3f256298b6d20228595f78 to your computer and use it in GitHub Desktop.
<template>
<div>
<input
type="text"
placeholder="Search Your Interest"
@input="debounceSearch()"
v-model="searchInput"
/>
</div>
</template>
<script>
export default {
data: () => {
return {
debounceTimeout: null,
searchInput: ""
};
},
methods: {
filterBlog() {
alert(this.searchInput);
},
debounceSearch: function() {
if (this.debounceTimeout) clearTimeout(this.debounceTimeout);
this.debounceTimeout = setTimeout(() => {
this.filterBlog();
}, 500); // delay for half second
}
}
};
</script>
@andreas83
Copy link

thank you

@ShmidtAlex
Copy link

thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment