Appearance
vue/no-v-for-template-key-on-child
禁止将
<template v-for>
的键放在子元素上
- ⚙️ 此规则包含在
"plugin:vue/essential"
、*.configs["flat/essential"]
、"plugin:vue/strongly-recommended"
、*.configs["flat/strongly-recommended"]
、"plugin:vue/recommended"
和*.configs["flat/recommended"]
中。
📖 规则详情
此规则报告放置在子元素上的 <template v-for>
的键。
¥This rule reports the key of the <template v-for>
placed on the child elements.
在 Vue.js 3.x 中,通过对片段的支持,<template v-for>
键可以放在 <template>
标签上。
¥In Vue.js 3.x, with the support for fragments, the <template v-for>
key can be placed on the <template>
tag.
有关更多详细信息,请参阅 迁移指南 - key
属性 > 带有 <template v-for>
。
¥See Migration Guide - key
attribute > With <template v-for>
for more details.
注意
此规则针对 Vue.js 3.x。如果你使用的是 Vue.js 2.x,请改为启用 vue/no-v-for-template-key 规则。不要同时启用两个规则;它们是冲突的。
¥This rule is targeted at Vue.js 3.x. If you are using Vue.js 2.x, enable the vue/no-v-for-template-key rule instead. Don't enable both rules together; they are conflicting.
🔧选项
¥🔧 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