vue/no-duplicate-attributes
禁止重复属性
- ⚙️ 此规则包含在所有
"plugin:vue/vue3-essential"、*.configs["flat/essential"]、"plugin:vue/essential"、*.configs["flat/vue2-essential"]、"plugin:vue/vue3-strongly-recommended"、*.configs["flat/strongly-recommended"]、"plugin:vue/strongly-recommended"、*.configs["flat/vue2-strongly-recommended"]、"plugin:vue/vue3-recommended"、*.configs["flat/recommended"]、"plugin:vue/recommended"和*.configs["flat/vue2-recommended"]中。
当组件上有多个同名属性时,只有最后一个属性会被使用,其余的都会被忽略,所以这通常是一个错误。
📖 规则详情
此规则报告重复的属性。 v-bind:foo 指令被视为属性 foo。
🔧 选项
json
{
"vue/no-duplicate-attributes": ["error", {
"allowCoexistClass": true,
"allowCoexistStyle": true
}]
}allowCoexistClass(boolean) ... 启用v-bind:class指令可以与普通的class属性共存。默认为true。allowCoexistStyle(boolean) ... 启用v-bind:style指令可以与普通的style属性共存。默认为true。
"allowCoexistClass": false, "allowCoexistStyle": false
🚀 版本
此规则在 eslint-plugin-vue v3.0.0 中引入