vue遍历数据及字典的方法
数组:数值
<ul id="example-1">
<li v-for="item in items">
{{ item.message }}
</li>
</ul>
数组:数值加索引
<ul>
<template v-for="(item,index) of items">
<li>{{ item.msg }}</li>
<li>{{index}}</li>
</template>
</ul>
字典:key value index
<ul id="repeat">
<li v-for="(value,key,index) in object">
{{ value }} {{key}} {{index}}
</li>
</ul>
new Vue({
el: '#repeat',
data: {
object: {
FirstName: 'John',
LastName: 'Doe',
Age: 30
}
}
})