diff options
Diffstat (limited to 'iridescence/src/components/InventorySearch.vue')
-rw-r--r-- | iridescence/src/components/InventorySearch.vue | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/iridescence/src/components/InventorySearch.vue b/iridescence/src/components/InventorySearch.vue new file mode 100644 index 0000000..fbcaabb --- /dev/null +++ b/iridescence/src/components/InventorySearch.vue @@ -0,0 +1,36 @@ +<template> + <div id="inventorySearch"> + <input + class="input is-primary is-medium" + type="text" + placeholder="Find something in particular..." + v-model.trim="term" + @input="updateSearch" + autofocus + /> + <content class="has-text-centered" v-if="noResults"> + <p>We couldn't find anything like that...</p> + </content> + </div> +</template> + +<script> +export default { + name: "InventorySearch", + data() { + return { + term: "" + }; + }, + computed: { + noResults() { + return !this.$store.getters.inventory.length; + } + }, + methods: { + updateSearch() { + this.$store.commit("filterTerm", this.term); + } + } +}; +</script> |