Enter listener on Search

This commit is contained in:
Liam Dyer
2020-04-18 10:35:47 -04:00
parent c77e9072f5
commit 11b67a8bfc
2 changed files with 12 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
<template lang="pug">
input.search(v-model="searchInput" type="text" placeholder="Search")
input.search(v-model="searchInput" @keydown.enter="onEnter" type="text" placeholder="Search")
</template>
<script>
@@ -22,6 +22,10 @@ export default {
R.join(''),
R.adjust(0, () => '')
),
onEnter() {
const searchParams = new URLSearchParams({ ...this.$route.query, enter: true })
this.$router.push(this.searchPath + '?' + searchParams.toString())
},
},
watch: {
searchInput(input) {