0๐
โ
new Vue({
el: '#test',
data: {
array: ['a', 'b', 'c', 'd'],
myObject: {
A: 'a',
B: 'b',
C: 'c'
}
}
});
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<div id="test">
<ul>
<li v-for="(item, indice) in array">{{item}} - {{indice}}</li>
</ul>
<ul>
<li v-for="(item, cle, indice) in myObject">{{cle}} : {{item}} - {{indice}}</li>
</ul>
</div>
Source:stackexchange.com