B
B
billt2017-08-07 15:42:24
JavaScript
billt, 2017-08-07 15:42:24

How to make an infinite loop through descendants in vue.js?

From the Backend comes an object that has a list of items, some have children, and so on. The nesting list can be endless. You need to render this object into a hierarchical tree, like this:
d972439274b849f8acf6157365b11bfd.png
I just made three nested v-for loops, but I need a more flexible way so that I can add a fourth level of nesting, etc.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Cheremisin, 2017-08-07
@billt

Here, straight from the standard examples https://vuejs.org/v2/examples/tree-view.html , I did something similar a week ago.
The tree itself, however, is stored in vuex, for which I had to transfer the example a bit both for my data and for my actions. But it’s not difficult there, as a person with vue, I’m only two weeks old :-)
It turned out something like this:
3b4af24d9f374ebea61d6ee22c644f19.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question