From e881020f86004af2926107261a8b3067c0c20cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Glasn=C3=A1k?= Date: Tue, 29 Nov 2022 20:28:34 +0100 Subject: [PATCH] [Teams] Autocomplete input component --- app/src/plugins/app/_components/w-autocomplete.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/plugins/app/_components/w-autocomplete.vue b/app/src/plugins/app/_components/w-autocomplete.vue index 608a4cb..e5f1c63 100644 --- a/app/src/plugins/app/_components/w-autocomplete.vue +++ b/app/src/plugins/app/_components/w-autocomplete.vue @@ -7,7 +7,7 @@ @keydown.enter="optionSelected()" /> -
+
{{ suggestion._suggestionHiddenPart }} {{ suggestion._suggestionShownPart }}
@@ -36,7 +36,7 @@ export default { const normalizedSearch = this._normalize(this.search) if (!normalizedSearch.length || !this.options.length) - return '' + return null const filteredOptions = this.options.filter(option => { const normalizedValue = this._normalize(option.value) @@ -45,7 +45,7 @@ export default { }) if (!filteredOptions[0]) - return '' + return null const suggestion = { ...filteredOptions[0], @@ -60,6 +60,9 @@ export default { methods: { optionSelected() { + if (!this.suggestion) + return + this.$emit('option-selected', this.suggestion) this.search = '' },