Skip to content

Commit

Permalink
Fix #171: empty search opens first item
Browse files Browse the repository at this point in the history
  • Loading branch information
bastienwirtz committed Dec 19, 2020
1 parent 168810d commit c1b5f6a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/SearchInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
ref="search"
:value="value"
@input="search($event.target.value)"
@keyup.enter.exact="$emit('search-open')"
@keyup.alt.enter="$emit('search-open', '_blank')"
@keyup.enter.exact="open()"
@keyup.alt.enter="open('_blank')"
/>
</div>
</template>
Expand Down Expand Up @@ -37,6 +37,12 @@ export default {
}
},
methods: {
open: function (target = null) {
if (!this.$refs.search.value) {
return;
}
this.$emit("search-open", target);
},
focus: function () {
this.$emit("search-focus");
this.$nextTick(() => {
Expand Down

0 comments on commit c1b5f6a

Please sign in to comment.