美文网首页
Custom elements in iteration req

Custom elements in iteration req

作者: 程序员伟哥 | 来源:发表于2019-02-13 18:50 被阅读0次

其实提示的已经很清楚了,自定义元素在循环迭代时,需要加
v-bind:key 指令

修改前:

 <template v-for="(item, itemIndex) in data">
      <thumbnail-item-new
        :data="item"
      >
</thumbnail-item-new>

修改后(粗体部分)

   <template v-for="(item, itemIndex) in data">
      <thumbnail-item-new
        :data="item"
        v-bind:key="itemIndex"
      ></thumbnail-item-new>
    </template>

当然有人说可以配置IDE,让它忽略校验,不过个人建议,人家都给指出来我们的问题了,为什么不改正呢?
Good Good Study,Day Day Up

相关文章

网友评论

      本文标题:Custom elements in iteration req

      本文链接:https://www.haomeiwen.com/subject/ilzdeqtx.html