<template> <div> <div v-for="(item, key, index) of arrExample" :key="key"> {{item}}--{{key}}--{{index}}<br> </div> </div> </template> <script> export default { name: 'Home', data () { return { arrExample: { id: '001', name: 'lanyubing', school: 'scut' } } } } </script>
输出结果:
001--id--0 lanyubing--name--1 scut--school--2
然后根据顺序,对号入座。