Skip to content

vue/require-v-for-key

要求 v-bind:key 带有 v-for 指令

  • ⚙️ 此规则包含在 "plugin:vue/essential"*.configs["flat/essential"]"plugin:vue/vue2-essential"*.configs["flat/vue2-essential"]"plugin:vue/strongly-recommended"*.configs["flat/strongly-recommended"]"plugin:vue/vue2-strongly-recommended"*.configs["flat/vue2-strongly-recommended"]"plugin:vue/recommended"*.configs["flat/recommended"]"plugin:vue/vue2-recommended"*.configs["flat/vue2-recommended"] 中。

📖 规则详情

此规则报告具有 v-for 但没有 v-bind:key 的元素,自定义组件除外。

¥This rule reports the elements which have v-for and do not have v-bind:key with exception to custom components.

Now loading...

注意

此规则不报告自定义组件上缺少的 v-bind:key。它将由 vue/valid-v-for 规则报告。

¥This rule does not report missing v-bind:key on custom components. It will be reported by vue/valid-v-for rule.

🔧选项

¥🔧 Options

无。

¥Nothing.

👫相关规则

¥👫 Related Rules

📚扩展阅读

¥📚 Further Reading

🚀版本

¥🚀 Version

此规则在 eslint-plugin-vue v3.0.0 中引入

¥This rule was introduced in eslint-plugin-vue v3.0.0

🔍代码实现

¥🔍 Implementation

eslint-plugin-vue v10.0 中文网 - 粤ICP备13048890号