diff options
Diffstat (limited to 'iridescence/src/components/ProductSearch.vue')
-rw-r--r-- | iridescence/src/components/ProductSearch.vue | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/iridescence/src/components/ProductSearch.vue b/iridescence/src/components/ProductSearch.vue index d492b66..f60931c 100644 --- a/iridescence/src/components/ProductSearch.vue +++ b/iridescence/src/components/ProductSearch.vue @@ -45,6 +45,7 @@ export default { data() { return { term: "", + searchTimer: function() {}, sortOptions: { "Featured Items": a => (a.featured ? -1 : 1), "In Stock": (a, b) => a.quantity < b.quantity, @@ -72,7 +73,10 @@ export default { }, methods: { updateSearch() { - this.$store.commit("searchTerm", this.term); + clearTimeout(this.searchTimer); + this.timeout = setTimeout(() => { + this.$store.commit("searchTerm", this.term); + }, 1000); }, updateSort() { this.$store.commit("compare", this.sortOptions[this.sortOptionName]); @@ -80,3 +84,5 @@ export default { } }; </script> + + |