started search form and store
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
/>
|
||||
</h1>
|
||||
</header>
|
||||
<div class="text-quantity" v-html="item.textsQuantity"/>
|
||||
<div class="text-quantity" v-html="item.textsQuantity" />
|
||||
</article>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user