Vue JS – Loop through nested object without knowing its name

  axios, javascript, lodash, vue.js, web

I perform an axios call which returns the following (example):

{
   "data":{
      "xyz":[
         {
            "foo":1234,
            "baz":5678,
         }
      ]
   }
}

I have a .then() in my axios call where I use lodash to _.cloneDeep my response.data (above) to a data property in my vue instance.

What is the right way to do a v-for on xyz without knowing it’s name (it can be different)? Or how do I directly clone xyz to my data property?

Source: Ask Javascript Questions

LEAVE A COMMENT