TAGS :Viewed: 17 - Published at: a few seconds ago

[ How can i 'v-repeat' through this object? ]

When i use 'v-repeat' i can see the 'post.letter', however it looks like i also need to loop trough the posts array in the same 'v-repeat' ?

When i try 'post.posts.title' i get nothing, when i do 'post.posts' i get [object, object].

        var myObj = [
        {
            post: {
                letter: 'A',
                posts: [
                    { title: 'lorem ipsum'},
                    { title: 'dolor sit amet'}
                ],
            }
        }
    ];

Answer 1


If I'm understanding what you want correctly you can use aliases

<h4>{{ post.letter }}</h4>
<ul>
    <li v-repeat="subPost : post.posts"> {{ subPost.title }}</li>
</ul>

Hope this helps!