Appearance
vue/no-duplicate-attr-inheritance
在使用
v-bind="$attrs"时强制将inheritAttrs设置为false¥enforce
inheritAttrsto be set tofalsewhen usingv-bind="$attrs"
📖 规则详情
此规则旨在防止重复的属性继承。此规则建议在检测到正在使用 v-bind="$attrs" 时应用 inheritAttrs: false。
¥This rule aims to prevent duplicate attribute inheritance.\ This rule suggests applying inheritAttrs: false when it detects v-bind="$attrs" being used.
🔧选项
¥🔧 Options
json
{
"vue/no-duplicate-attr-inheritance": ["error", {
"checkMultiRootNodes": false,
}]
}"checkMultiRootNodes":如果设置为true,还建议在检测到使用v-bind="$attrs"时将inheritAttrs: false应用于具有多个根节点的组件(其中inheritAttrs: false是隐式默认值,请参阅 多个根节点上的属性继承)。默认值为false,它将忽略具有多个根节点的组件。¥
"checkMultiRootNodes": If set totrue, also suggest applyinginheritAttrs: falseto components with multiple root nodes (whereinheritAttrs: falseis the implicit default, see attribute inheritance on multiple root nodes), whenever it detectsv-bind="$attrs"being used. Default isfalse, which will ignore components with multiple root nodes.
"checkMultiRootNodes": true
📚扩展阅读
¥📚 Further Reading
🚀版本
¥🚀 Version
此规则在 eslint-plugin-vue v7.0.0 中引入
¥This rule was introduced in eslint-plugin-vue v7.0.0
🔍代码实现
¥🔍 Implementation