Answer the question
In order to leave comments, you need to log in
Error in v-for="todo of todos" in Vue.js. What is the correct v-for syntax?
When using the v-for="todo in todos" directive, an error is thrown:
Failed to compile.
./src/components/TodoList.vue
Module Error (from ./node_modules/eslint-loader/index.js):
D:\vue\vue-beganning\src\components\TodoList.vue
4:7 error Custom elements in iteration require 'v-bind:key' directives vue/valid-v-for
✖ 1 problem (1 error, 0 warnings)
<template>
<div>
<ul>
<TodoItem
v-for="todo in todos"
v-bind:todo="todo"
/>
</ul>
</div>
</template>
<script>
import TodoItem from '@/components/TodoItem'
export default {
props: ['todos'],
components: {
TodoItem
}
}
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question