vuejs-autocomplete icon indicating copy to clipboard operation
vuejs-autocomplete copied to clipboard

Different formatted string then selected

Open merijnponzo opened this issue 7 years ago • 3 comments

Hello Charlie, I was wondering, since you added v-html i can add images to the results, awesome, but when I select a result item, the html string is placed into the input field of the autocomplete (the value is correct, is the ID of the dog breed :) )

schermafbeelding 2017-11-27 om 08 52 41

I tried

@close="closeWindow"
@selected="selectString"
@enter="applyString"

With methods to return a different a different string, for example only the name "affenpinscher" But with no result

How can I affect the input string on selected, NOT the value

Best

merijnponzo avatar Nov 27 '17 07:11 merijnponzo

Ah good point! We need another property then for the input value or probably better make the switch to a div rather than a text input for the selected value.

charliekassel avatar Nov 27 '17 08:11 charliekassel

I could imagine that just displaying the html string into the div would do it, but having a possibility to use any data would be superb. Thanks charlie (for the time being i'm just swapping the autocomplete with a div on selected, but the user have to tab it twice to get the autocomplete result :)

merijnponzo avatar Nov 27 '17 09:11 merijnponzo

I could get the user selected data in input field like name but if i go with your data id and name i got the selected data in the input field

Format: :source="[{state:'Andhra Pradesh',name:'Rajahmundry Airport'},{state:'Telangana',name:'Hyderabad Airport'}]"

raajshekhar avatar Feb 18 '18 03:02 raajshekhar