Answer the question
In order to leave comments, you need to log in
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#friends
remains empty.
I use an object instead of a string, because in item-text
should be substituted name
, and in input-value
- id
Question : why input#friends
empty and how to substitute the id
selected element there?
How I temporarily solved the problem:
- I created it separately input#friendId
- I created a property separately friendId
- I tied watcher
it to change friends
- I friendId
insert 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
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 ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question