小编use*_*975的帖子

获取错误“ index.vue中的迭代元素期望具有'v-bind:key'指令vue / require-v-for-key“

我是vue.js的新手。我有一个简单的index.vue,它试图连接到内容丰富的目录并显示内容丰富的条目。我在index.vue中的代码如下所示:


<template>
  <div>
    <!-- render data of the person -->
    <h1>{{ person.fields.name }}</h1>
    <!-- render blog posts -->
    <ul>
      <li v-for="post in posts">
        {{ post.fields.title }}
      </li>
    </ul>
  </div>
</template>

<script>
  import {createClient} from '~/plugins/contentful.js'

  const client = createClient()
Run Code Online (Sandbox Code Playgroud)

但是,当我从浏览器尝试localhost:3000时,它返回以下错误:


./pages/index.vue模块错误(来自./node_modules/eslint-loader/index.js):

C:\ Users \ admin \ pdress \ pages \ index.vue 7:7错误迭代中的元素期望具有'v-bind:key'指令vue / require-v-for-key

?1个问题(1个错误,0个警告)


如果有人可以帮助我进一步进行vue.js的学习,我将不胜感激。提前致谢

vue.js contentful

3
推荐指数
1
解决办法
2083
查看次数

标签 统计

contentful ×1

vue.js ×1