Elements in iteration expect to have ‘v-bind:key‘ directives.
使用Vue的v-for时,报错Elements in iteration expect to have ‘v-bind:key’ directives,虽然程序还能运行,但是总得把错误解决。
这句话大概意思是:迭代中的元素得加个键
也就是说有个1、2、3…对应。
看代码:
<li v-for="(todo, index) in todos" :key="index">
<label>{{ index + 1 }}.{{ todo.value }}</label>
<
原创
2020-11-06 20:10:25 ·
147 阅读 ·
0 评论