Answer the question
In order to leave comments, you need to log in
How to filter by one field in Vue?
I made the code https://jsfiddle.net/wwqy9a5p/1/
I would like it to search only by the name field and if you enter any number, 11, for example, then nothing was found.
The problem is clearly in the line <li v-for="array in filterBy(arrays, input)">
. But a couple of attempts to fix it, for example, to make arrays.name or arrays, input in name (as in vue 1.0) only led to the script not working.
Answer the question
In order to leave comments, you need to log in
The problem is clearly in the line
Yes, you need to add the name of the property you want to filter by as the third parameter.
Or you can do without third-party libraries and format the filtered data as a computed property.
https://jsfiddle.net/jbd5amvo/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question