From c1b5f6adabf6bdd35a6b562f796ffbefa77f7cbc Mon Sep 17 00:00:00 2001 From: Bastien Wirtz Date: Sat, 19 Dec 2020 15:59:01 -0800 Subject: [PATCH] Fix #171: empty search opens first item --- src/components/SearchInput.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/SearchInput.vue b/src/components/SearchInput.vue index eb9c97860..40c5a1de1 100644 --- a/src/components/SearchInput.vue +++ b/src/components/SearchInput.vue @@ -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')" /> @@ -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(() => {