diff options
author | Bastien Wirtz <bastien.wirtz@gmail.com> | 2020-12-19 15:59:01 -0800 |
---|---|---|
committer | Bastien Wirtz <bastien.wirtz@gmail.com> | 2020-12-19 15:59:01 -0800 |
commit | c1b5f6adabf6bdd35a6b562f796ffbefa77f7cbc (patch) | |
tree | 1522900970fe780e8dd609df342ff118cce27ddd | |
parent | 168810d76f7d4ad929737fedf18dd8d9decb4d89 (diff) | |
download | homer-c1b5f6adabf6bdd35a6b562f796ffbefa77f7cbc.tar.gz homer-c1b5f6adabf6bdd35a6b562f796ffbefa77f7cbc.tar.zst homer-c1b5f6adabf6bdd35a6b562f796ffbefa77f7cbc.zip |
Fix #171: empty search opens first itemv20.12.19
-rw-r--r-- | src/components/SearchInput.vue | 10 |
1 files changed, 8 insertions, 2 deletions
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 @@ | |||
6 | ref="search" | 6 | ref="search" |
7 | :value="value" | 7 | :value="value" |
8 | @input="search($event.target.value)" | 8 | @input="search($event.target.value)" |
9 | @keyup.enter.exact="$emit('search-open')" | 9 | @keyup.enter.exact="open()" |
10 | @keyup.alt.enter="$emit('search-open', '_blank')" | 10 | @keyup.alt.enter="open('_blank')" |
11 | /> | 11 | /> |
12 | </div> | 12 | </div> |
13 | </template> | 13 | </template> |
@@ -37,6 +37,12 @@ export default { | |||
37 | } | 37 | } |
38 | }, | 38 | }, |
39 | methods: { | 39 | methods: { |
40 | open: function (target = null) { | ||
41 | if (!this.$refs.search.value) { | ||
42 | return; | ||
43 | } | ||
44 | this.$emit("search-open", target); | ||
45 | }, | ||
40 | focus: function () { | 46 | focus: function () { |
41 | this.$emit("search-focus"); | 47 | this.$emit("search-focus"); |
42 | this.$nextTick(() => { | 48 | this.$nextTick(() => { |