mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
[Teams] Autocomplete input component
This commit is contained in:
1 parent
da9d338175
commit
e881020f86
1 file changed
+6
-3
@@ -7,7 +7,7 @@
|
||||
@keydown.enter="optionSelected()"
|
||||
/>
|
||||
|
||||
<div class="suggestion">
|
||||
<div class="suggestion" v-if="suggestion">
|
||||
<span class="hidden-part">{{ suggestion._suggestionHiddenPart }}</span>
|
||||
<span>{{ suggestion._suggestionShownPart }}</span>
|
||||
</div>
|
||||
@@ -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 = ''
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user