diff options
author | Robin Schneider <45321827+robinschneider@users.noreply.github.com> | 2021-10-25 14:06:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-25 14:06:41 +0200 |
commit | f2c901a1ec45c91a3fb02333a61bb9d0c82e2859 (patch) | |
tree | a1a8d4f5b39a833ef2306824adc1d1ccf22b512f /src/components | |
parent | 487f954a3688f31d5bcc5ba614cde4da3d5deedb (diff) | |
parent | cf33747f4272baf124b99af9ed8efcca07d1d6b9 (diff) | |
download | homer-f2c901a1ec45c91a3fb02333a61bb9d0c82e2859.tar.gz homer-f2c901a1ec45c91a3fb02333a61bb9d0c82e2859.tar.zst homer-f2c901a1ec45c91a3fb02333a61bb9d0c82e2859.zip |
Merge branch 'bastienwirtz:main' into apikey
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/SearchInput.vue | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/components/SearchInput.vue b/src/components/SearchInput.vue index 40c5a1d..586ff71 100644 --- a/src/components/SearchInput.vue +++ b/src/components/SearchInput.vue | |||
@@ -15,10 +15,16 @@ | |||
15 | <script> | 15 | <script> |
16 | export default { | 16 | export default { |
17 | name: "SearchInput", | 17 | name: "SearchInput", |
18 | props: ["value"], | 18 | props: { |
19 | value: String, | ||
20 | hotkey: { | ||
21 | type: String, | ||
22 | default: "/" | ||
23 | } | ||
24 | }, | ||
19 | mounted() { | 25 | mounted() { |
20 | this._keyListener = function (event) { | 26 | this._keyListener = function (event) { |
21 | if (event.key === "/") { | 27 | if (event.key === this.hotkey) { |
22 | event.preventDefault(); | 28 | event.preventDefault(); |
23 | this.focus(); | 29 | this.focus(); |
24 | } | 30 | } |
@@ -28,7 +34,7 @@ export default { | |||
28 | }; | 34 | }; |
29 | document.addEventListener("keydown", this._keyListener.bind(this)); | 35 | document.addEventListener("keydown", this._keyListener.bind(this)); |
30 | 36 | ||
31 | // fill seach from get parameter. | 37 | // fill search from get parameter. |
32 | const search = new URLSearchParams(window.location.search).get("search"); | 38 | const search = new URLSearchParams(window.location.search).get("search"); |
33 | if (search) { | 39 | if (search) { |
34 | this.$refs.search.value = search; | 40 | this.$refs.search.value = search; |