解决方案一
v-for(v,k)括号后面这里要加空格,不能贴着in,否则会报错
1 <body> 2 3 <section id="app"> 4 <table v-for='(item,index ) in monster'> 5 <tr> 6 <th>名称</th> 7 </tr> 8 <tr> 9 <td>{{item}}</td> 10 <td>{{item.name}}</td> 11 <td>{{index}}</td> 12 </tr> 13 14 </table> 15 </section> 16 17 <script> 18 var app = new Vue({ 19 el: '#app', 20 data: { 21 monster: [ 22 { name: '独眼蝙蝠', lv: 1, hp: 100 }, 23 { name: '彭哚菇', lv: 3, hp: 300 } 24 ] 25 }, 26 methods: {}, 27 }) 28 </script> 29 </body>