[Vuejs]-@vue.cli 4.2.3 json array in vue component

0๐Ÿ‘

โœ…

If my understanding is correct you want something like this:

new Vue({
  el: "#app",
  data: {
      jsonHero: {
        "0": {
          first: "apple",
          lists: ["red", "round", "big"],
        },
        "1": {
          first: "mango",
          lists: ["yes", "square", "small"],
        },
      },
  },
  methods: {
  }
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
    <div v-for="(data, indeex) in jsonHero" :key="indeex">
      <h2>{{ data.first }}</h2>
      <ul>
        <li v-for="(item, index) in data.lists" :key="index">{{ item }}</li>
      </ul>
    </div>
</div>

Leave a comment