Skip to content

Files

Latest commit

 

History

History
32 lines (22 loc) · 899 Bytes

no-v-for-template-key-on-child.md

File metadata and controls

32 lines (22 loc) · 899 Bytes

Pattern: Use of key of <template v-for> placed on child elements

Issue: -

Description

This rule reports the key of the <template v-for> placed on the child elements.

In Vue.js 3.x, with the support for fragments, the <template v-for> key can be placed on the <template> tag.

<template>
  <!-- ✓ GOOD -->
  <template v-for="todo in todos" :key="todo">
    <Foo />
  </template>

  <!-- ✗ BAD -->
  <template v-for="todo in todos">
    <Foo :key="todo" />
  </template>
</template>

Further Reading