1616 :query =" text"
1717 ></slot >
1818
19- <div class =" suggest-item" v-for =" suggestion in suggestions"
19+ <div class =" suggest-item" v-for =" ( suggestion, index) in suggestions"
2020 @mouseenter =" hover(suggestion, $event.target)"
2121 @mouseleave =" hover(null, $event.target)"
22- :key =" valueProperty(suggestion)"
22+ :key =" isPlainSuggestion ? 'suggestion-' + index : valueProperty(suggestion)"
2323 :class =" {
2424 selected: selected && (valueProperty(suggestion) == valueProperty(selected)),
2525 hover: hovered && (valueProperty(hovered) == valueProperty(suggestion))
@@ -118,15 +118,15 @@ export default {
118118 canSend: true ,
119119 timeoutInstance: null ,
120120 text: this .value ,
121- isSuggestionConverted : false ,
121+ isPlainSuggestion : false ,
122122 controlScheme: {}
123123 }
124124 },
125125 computed: {
126126 slotIsComponent () {
127127 return (this .$slots .default && this .$slots .default .length > 0 ) && !! this .$slots .default [0 ].componentInstance
128128 },
129- listIsRequest () {
129+ listIsRequest () {
130130 return typeof this .list === ' function' ;
131131 },
132132 input () {
@@ -156,13 +156,15 @@ export default {
156156 },
157157 methods: {
158158 displayProperty (obj ) {
159- return fromPath (obj, this .displayAttribute );
159+ return this . isPlainSuggestion ? obj : fromPath (obj, this .displayAttribute );
160160 },
161161 valueProperty (obj ) {
162- return fromPath (obj, this .valueAttribute );
162+ return this . isPlainSuggestion ? obj : fromPath (obj, this .valueAttribute );
163163 },
164164 select (item ) {
165165 this .selected = item
166+
167+ // Get current item regardless of internal structure
166168 this .$emit (' select' , item)
167169
168170 // Ya know, input stuff
@@ -178,6 +180,7 @@ export default {
178180 hover (item , elem ) {
179181 this .hovered = item
180182 if (this .hovered != null ) {
183+ // Send current item regardless of internal structure
181184 this .$emit (' hover' , item, elem)
182185 }
183186 },
@@ -333,13 +336,9 @@ export default {
333336 if (! Array .isArray (result)) { result = [result] }
334337
335338 if (typeof result[0 ] === ' object' && ! Array .isArray (result[0 ])) {
336- this .isSuggestionConverted = false ;
339+ this .isPlainSuggestion = false ;
337340 } else {
338- result = result .map ((el , i ) => ({
339- [this .valueAttribute ]: i,
340- [this .displayAttribute ]: el
341- }));
342- this .isSuggestionConverted = true ;
341+ this .isPlainSuggestion = true ;
343342 }
344343
345344 if (this .filterByQuery ) {
0 commit comments