diff --git a/src/components/autocomplete/AutoComplete.vue b/src/components/autocomplete/AutoComplete.vue index 20b584f5c..b851447b8 100755 --- a/src/components/autocomplete/AutoComplete.vue +++ b/src/components/autocomplete/AutoComplete.vue @@ -8,7 +8,8 @@
  • - +
  • @@ -85,8 +86,8 @@ export default { return { searching: false, focused: false, - filled: false, - overlayVisible: false + overlayVisible: false, + inputTextValue: null }; }, watch: { @@ -154,6 +155,8 @@ export default { selectItem(event, item) { if (this.multiple) { this.$refs.input.value = ''; + this.inputTextValue = ''; + if (!this.isSelected(item)) { let newValue = this.value ? [...this.value, item] : [item]; this.$emit('input', newValue); @@ -227,6 +230,8 @@ export default { }); }, onInput(event) { + this.inputTextValue = event.target.value; + if (this.timeout) { clearTimeout(this.timeout); } @@ -390,7 +395,7 @@ export default { return ['p-autocomplete p-component', { 'p-autocomplete-dd': this.dropdown, 'p-autocomplete-multiple': this.multiple, - 'p-inputwrapper-filled': this.value, + 'p-inputwrapper-filled': ((this.value && this.value.length) || (this.inputTextValue && this.inputTextValue.length)), 'p-inputwrapper-focus': this.focused }]; },