started search form and store

This commit is contained in:
2019-08-23 19:17:07 +02:00
parent 07f35b0e89
commit b8fc27a93d
5 changed files with 88 additions and 8 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
/>
</h1>
</header>
<div class="text-quantity" v-html="item.textsQuantity"/>
<div class="text-quantity" v-html="item.textsQuantity" />
</article>
</template>
+40 -4
View File
@@ -1,14 +1,50 @@
<template>
<div id="search">
Search
<form class="" action="index.html" method="post">
<label for="keywords">
Search
<input
id="keywords"
v-model="keywords"
type="text"
placeholder="search"
>
</label>
<input
id="search"
type="submit"
name="search"
value="Search"
@click.prevent="submit"
@keyup.enter="submit"
>
</form>
</div>
</template>
<script>
import { mapState, mapActions } from 'vuex'
export default {
name: 'Search',
data: () => ({
})
// data: () => ({
// keywords: ''
// }),
computed: {
...mapState({
keywords: state => state.Search.keywords
})
},
methods: {
...mapActions({
getResults: 'Search/getResults'
}),
submit () {
console.log('submited', this.keywords)
this.getResults()
}
}
}
</script>
<style lang="scss" scoped>