I get data something like this and say that I get depth of groups to infinity.
data/group.data.json
module.exports = [
{
id: '1',
title: 'Awesome Group',
type: '1',
groups: [
{
id: '5',
title: 'Child in Level Two - A',
type: '2',
groups: [
{
id: '6',
title: 'Child in Level Three - A',
type: '2',
},
{
id: '8',
title: 'Child in Level Three - B',
type: '2',
}
]
},
{
id: '7',
title: 'Child in Level Two - B',
type: '2',
}
]
},
{
id: '2',
title: 'Rockers',
type: '2',
},
{
id: '3',
title: 'Dazzlers',
type: '3',
}
];
I cannot do this manually like below, How to iterate it till the end dynamically?
<ul class="list-group list-group-flush">
<template v-for="group in groupData">
<a class="list-group-item" href="#">
<h6>{{group.title}}</h6>
</a>
<template v-for="group in group.groups">
<a class="list-group-item pl-40" href="#">
<h6>{{group.title}}</h6>
</a>
<template v-for="group in group.groups">
<a class="list-group-item pl-60" href="#">
<h6>{{group.title}}</h6>
</a>
</template>
</template>
</template>
</ul>
<script>
let groupData = require('../data/group.data');
export default {
data () {
return {
groupData,
}
}
}
</script>
There is one answer kinda what I want, but not sure how to use in my case: https://stackoverflow.com/a/13523953/1292050