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