Skip to content

Files

Latest commit

 

History

History
33 lines (23 loc) · 844 Bytes

no-v-for-template-key.md

File metadata and controls

33 lines (23 loc) · 844 Bytes

Pattern: Use of <template v-for> element with key attribute

Issue: -

Description

This rule reports the <template v-for> elements which have key attribute.

In Vue.js 2.x, disallows key attribute on <template> elements.

<template>
  <!-- ✓ GOOD -->
  <template v-for="item in list">
    <div :key="item.id" />
  </template>

  <!-- ✗ BAD -->
  <template v-for="item in list" :key="item.id">
    <div />
  </template>
</template>

Further Reading