Vue报错:Elements in iteration expect to have ‘v-bind:key‘ directives的解决办法
1.我们在使用v-for的时候,在v-for 后添加 v-bind:key="item"<div v-for="todo in todos" :key="todo"><span>这是内容</span></div>
   ·  
 1.我们在使用v-for的时候,在v-for 后添加 v-bind:key="ite
Vue 2.2.0+的版本里,当在组件中使用v-for时,key是必须的。
1.我们在使用v-for的时候,在v-for 后添加 v-bind:key="item"
<div v-for="todo in todos" :key="todo">
    <span>这是内容</span>
</div>2.我们可以更改vetur配置 :vscode文件(file)->首选项(preferences)->设置(settings)->搜索vetur.validation.Template,将这一项去掉该为false就可以了

更多推荐
 
 



所有评论(0)