S
S
Scott2019-06-10 18:48:41
Vue.js
Scott, 2019-06-10 18:48:41

Vuetify Autocomplete: Why is the selected id not being substituted?

The example from the documentation is not much modified.
Problem : when submitting the form, an empty value is returned.
Cause : When an item is selected from the list value, y input#friendsremains empty.
I use an object instead of a string, because in item-textshould be substituted name, and in input-value- id
Question : why input#friendsempty and how to substitute the idselected element there?
How I temporarily solved the problem:
- I created it separately input#friendId
- I created a property separately friendId
- I tied watcherit to change friends
- I friendIdinsert a new value
into This way, in general, it works, but it seems to me that this is some kind of crutch.
Similar property for this purposeitem-value is already there, but for some reason it doesn't work out of the box.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Scott, 2019-06-10
@g-unit

In general, I placed my input inside <template v-slot:selection="data">where there is access to the selected object. It turned out already without an extra watcher and properties.
Maybe someone will give a better answer, but for now ...

P
PEMOK, 2019-06-10
@PEMOK

I'm guessing autocomplete's v-model doesn't support objects. Create your own control based on the given

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question