Appearance
vue/no-v-for-template-key
禁止在
<template v-for>
上使用key
属性
- 🚫 此规则已弃用。
⚙️此规则包含在
"plugin:vue/vue2-essential"
、*.configs["flat/vue2-essential"]
、"plugin:vue/vue2-strongly-recommended"
、*.configs["flat/vue2-strongly-recommended"]
、"plugin:vue/vue2-recommended"
和*.configs["flat/vue2-recommended"]
中。¥⚙️ This rule is included in all of
"plugin:vue/vue2-essential"
,*.configs["flat/vue2-essential"]
,"plugin:vue/vue2-strongly-recommended"
,*.configs["flat/vue2-strongly-recommended"]
,"plugin:vue/vue2-recommended"
and*.configs["flat/vue2-recommended"]
.
📖 规则详情
此规则报告具有 key
属性的 <template v-for>
元素。
¥This rule reports the <template v-for>
elements which have key
attribute.
在 Vue.js 2.x 中,不允许在 <template>
元素上使用 key
属性。
¥In Vue.js 2.x, disallows key
attribute on <template>
elements.
注意
此规则针对 Vue.js 2.x。如果你使用的是 Vue.js 3.x,请改为启用 vue/no-v-for-template-key-on-child 规则。不要同时启用两个规则;它们是冲突的。
¥This rule is targeted at Vue.js 2.x. If you are using Vue.js 3.x, enable the vue/no-v-for-template-key-on-child rule instead. Don't enable both rules together; they are conflicting.
注意
如果你想报告放置在没有 v-for
的 <template>
上的键,请使用 vue/no-template-key 规则。
¥If you want to report keys placed on <template>
without v-for
, use the vue/no-template-key rule.
🔧选项
¥🔧 Options
无。
¥Nothing.
👫相关规则
¥👫 Related Rules
📚扩展阅读
¥📚 Further Reading
🚀版本
¥🚀 Version
此规则在 eslint-plugin-vue v7.0.0 中引入
¥This rule was introduced in eslint-plugin-vue v7.0.0
🔍代码实现
¥🔍 Implementation