diff options
author | jdlugosz963 <jdlugosz963@gmail.com> | 2021-11-19 09:57:58 +0100 |
---|---|---|
committer | jdlugosz963 <jdlugosz963@gmail.com> | 2021-11-19 09:57:58 +0100 |
commit | 10abd20260050174dd508038f0b95c5f8f740933 (patch) | |
tree | dfad854c6f510873ae3c12f21457fea1b0c9d72f /src/components | |
parent | 7f2f1e63826c0acb4514edfb1fbf7a884893f8c4 (diff) | |
download | lom_frontend-10abd20260050174dd508038f0b95c5f8f740933.tar.gz lom_frontend-10abd20260050174dd508038f0b95c5f8f740933.zip |
fix bugs
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/Searcher.vue | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/components/Searcher.vue b/src/components/Searcher.vue index 4a252a0..43dd7bd 100644 --- a/src/components/Searcher.vue +++ b/src/components/Searcher.vue | |||
@@ -1,6 +1,14 @@ | |||
1 | <template> | 1 | <template> |
2 | <div id="searcher"> | 2 | <div id="searcher"> |
3 | <input type="text" v-model='search' ref='input' @keydown="hotkeys" placeholder="Search!"> | 3 | <input |
4 | type="text" | ||
5 | v-model='search' | ||
6 | ref='input' | ||
7 | @keydown="hotkeys" | ||
8 | @blur="close()" | ||
9 | placeholder="Search!" | ||
10 | /> | ||
11 | |||
4 | <Sugestion | 12 | <Sugestion |
5 | v-for="sugestion in sugestions" | 13 | v-for="sugestion in sugestions" |
6 | :key="sugestion[0]" | 14 | :key="sugestion[0]" |
@@ -41,6 +49,10 @@ export default { | |||
41 | this.sugestions = sugestions | 49 | this.sugestions = sugestions |
42 | }, | 50 | }, |
43 | 51 | ||
52 | close() { | ||
53 | this.$emit('close') | ||
54 | }, | ||
55 | |||
44 | change_current(a=1) { | 56 | change_current(a=1) { |
45 | let index = this.sugestions.findIndex(element => element===this.current) | 57 | let index = this.sugestions.findIndex(element => element===this.current) |
46 | let new_current = this.sugestions[index+a] | 58 | let new_current = this.sugestions[index+a] |
@@ -61,8 +73,8 @@ export default { | |||
61 | hotkeys(e) { | 73 | hotkeys(e) { |
62 | switch(e.code) { | 74 | switch(e.code) { |
63 | case 'Escape': | 75 | case 'Escape': |
64 | this.$emit('close') | 76 | this.close() |
65 | break | 77 | break |
66 | case 'ArrowDown': | 78 | case 'ArrowDown': |
67 | e.preventDefault() | 79 | e.preventDefault() |
68 | this.change_current(1) | 80 | this.change_current(1) |