报错 Custom elements in iteration require ‘v-bind:key‘ directives.“

报错 Custom elements in iteration require ‘v-bind:key’ directives.

  • 在使用vue-cli工具进行开发时,使用v-for出现如下报错:
    在这里插入图片描述
  • 报错原因:vue规定使用v-for条件渲染,必须设置一个key,
  • 解决方法:
    1.1 添加key
<el-table-column v-for="(val, key) in tableLabel" :key="key" :prop="key" :label="val"/>

猜你喜欢

转载自blog.csdn.net/qq_50630857/article/details/132246743
今日推荐