Vue子组件代码如下:

 

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

 

服务启动之后,浏览器打开,报错如下:

2. vue使用v-for报错 Elements in iteration expect to have 'v-bind:key' directives

 

原因是:

       Vue 2.2.0+的版本里,当在组件中使用v-for时,key是必须的

 

解决办法:

       在v-for 后添加 :key='project'


        2. vue使用v-for报错 Elements in iteration expect to have 'v-bind:key' directives

相关文章:

  • 2021-11-02
  • 2021-09-27
  • 2021-07-18
  • 2022-12-23
猜你喜欢
  • 2022-01-17
  • 2021-07-12
  • 2021-10-25
  • 2021-10-01
  • 2021-12-24
  • 2021-05-01
  • 2021-08-30
相关资源
相似解决方案