Answer the question
In order to leave comments, you need to log in
VUE v-for outside or inside component?
Hello.
There is a complex list, with many html elements and js events at the line level.
what should be a vue component - a description of a single line of the list or the entire list.
After all, the component is reusable data, and this indicates that the component is a string.
However, in the examples found on the net, the whole list is taken out into the component.
It seems to me that creating a component from a string, leaving v-for in the "parent" code is more correct - readability will increase. But perhaps something else will suffer? ..
What is the right way?
Answer the question
In order to leave comments, you need to log in
If you think that the list string is a rather complicated element, then take it out into a separate component. It is obvious that he is quite self-sufficient. And the main thing here, as correctly noted above, is encapsulation or the fight against complexity. Separately, the row component will be easier to maintain and test if necessary.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question