<ul> <li v-for="(aff , index) in acc" :key="index">编号:{{aff.a}} <div>名字:{{aff.name}}</div> <div>年龄:{{aff.age}}</div> </li> </ul> <script> data () { return { acc:[ {a:‘3544‘, name:‘小米‘, age:50}, {a:‘3543‘, name:‘中米‘, age:51}, {a:‘3542‘, name:‘大米‘, age:52}, {a:‘3541‘, name:‘超大米‘, age:53} ] } } </script>
v-for="(变量名,下标名) in 目标数组" :key="下标名" 相当于for循环在页面直接输出