Skip to content
Advertisement

Vue.js – v-for to print object name only

I have a nested object and only wanted to print the object name. How do I do this in vue.js?

JavaScript

This code prints the entire content of the object being iterated:

JavaScript

How can I make it only print strings obj1 and obj2?

Thanks!

Advertisement

Answer

Add key,index in v-for loop like v-for="(obj,key,index) in object1"

JavaScript
Advertisement