Note

This is a documentation for version 7.0.0-beta.4.
To check version 6.2.2 go here. To check previous releases go here.

# vue/no-v-for-template-key

disallow key attribute on <template v-for>

  • ⚙️ This rule is included in all of "plugin:vue/essential", "plugin:vue/strongly-recommended" and "plugin:vue/recommended".

# 📖 Rule Details

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

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

Note

Do not use with the vue/no-v-for-template-key-on-child rule for Vue.js 3.x.
This rule conflicts with the vue/no-v-for-template-key-on-child rule.

<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>
Now loading...

Note

If you want to report keys placed on <template> without v-for, use the vue/no-template-key rule.

# 🔧 Options

Nothing.

# 📚 Further Reading

# 🔍 Implementation