vue/no-v-for-template-key
禁止在
<template v-for>
上使用key
属性
- ⚙️ 此规则包含在所有
"plugin:vue/essential"
、*.configs["flat/vue2-essential"]
、"plugin:vue/strongly-recommended"
、*.configs["flat/vue2-strongly-recommended"]
、"plugin:vue/recommended"
和*.configs["flat/vue2-recommended"]
中。
📖 规则详情
此规则报告具有 key
属性的 <template v-for>
元素。
在 Vue.js 2.x 中,禁止在 <template>
元素上使用 key
属性。
注意
此规则针对 Vue.js 2.x。如果您使用的是 Vue.js 3.x,请改为启用 vue/no-v-for-template-key-on-child 规则。不要同时启用这两个规则;它们是冲突的。
注意
如果您想报告在没有 v-for
的 <template>
上放置的键,请使用 vue/no-template-key 规则。
🔧 选项
无。
👫 相关规则
📚 进一步阅读
🚀 版本
此规则在 eslint-plugin-vue v7.0.0 中引入