showing results for - "vuejs nested v for"
Jona
02 Aug 2020
1<div v-for='(obj, key, index) in secondPanelDetails'
2  v-bind:key='index'
3  class='detail-wrapper'>
4  <span>{{ key }}:</span>
5  <span v-if='Array.isArray(obj)'>
6    <div v-for='(el, index) in obj'
7      v-bind:key='index'>
8      {{ el }}
9    </div>
10  </span>
11  <span v-else>{{ obj }}</span>
12</div>
13
Eléonore
01 Jan 2021
1 new Vue({
2  el: '#sample',
3  data: {
4    private: {
5      folders : [{
6          name : 'folder1',
7          checks : [
8            { name : 'check1.1' },
9            { name : 'check1.2' }
10          ]
11        },
12        {
13          name : 'folder2',
14          checks : [
15            { name : 'check2.1' },
16            { name : 'check2.2' }
17          ]
18        }
19      ]
20    }
21  }
22})
23
24<script src="https://cdn.jsdelivr.net/vue/latest/vue.js"></script>
25<div id="sample">
26  <div v-if = "private.folders!=null" v-for="folder in private.folders">
27  {{folder.name}}
28      <div v-for="check in folder.checks">
29          {{check.name}}
30      </div>
31  </div>
32</div>