您的位置: 首页 > 文章 > 2. vue使用v-for报错 Elements in iteration expect to have 'v-bind:key' directives 2. vue使用v-for报错 Elements in iteration expect to have 'v-bind:key' directives 分类: 文章 • 2023-04-05 15:46:57 Vue子组件代码如下: 服务启动之后,浏览器打开,报错如下: 原因是: Vue 2.2.0+的版本里,当在组件中使用v-for时,key是必须的 解决办法: 在v-for 后添加 :key='project'