]> git.immae.eu Git - github/bastienwirtz/homer.git/blobdiff - src/components/SearchInput.vue
Simplify the container starting process to allow it to run with a
[github/bastienwirtz/homer.git] / src / components / SearchInput.vue
index 40c5a1de1e02981705ca763e50234c9130f34e64..165c99299a552b7a893db4339aca64150805ac7d 100644 (file)
 <script>
 export default {
   name: "SearchInput",
-  props: ["value"],
+  props: {
+    value: String,
+    hotkey: {
+      type: String,
+      default: "/",
+    },
+  },
   mounted() {
     this._keyListener = function (event) {
-      if (event.key === "/") {
+      if (event.key === this.hotkey) {
         event.preventDefault();
         this.focus();
       }
@@ -28,7 +34,7 @@ export default {
     };
     document.addEventListener("keydown", this._keyListener.bind(this));
 
-    // fill seach from get parameter.
+    // fill search from get parameter.
     const search = new URLSearchParams(window.location.search).get("search");
     if (search) {
       this.$refs.search.value = search;