Skip to content

vue/no-use-v-else-with-v-for

禁止在与 v-for 相同的元素上使用 v-else-if/v-else

¥disallow using v-else-if/v-else on the same element as v-for

📖 规则详情

此规则报告同时具有 v-else-if/v-elsev-for 指令的元素。这在 Vue 中是有效的(v-else-if/v-else 将优先),但读起来很混乱。

¥This rule reports elements that have both v-else-if/v-else and v-for directives. That is valid in Vue (v-else-if/v-else will take precedence), but is confusing to read.

Now loading...

🔧选项

¥🔧 Options

无。

¥Nothing.

🔇何时不使用

¥🔇 When Not To Use It

如果你发现将 v-else-if/v-elsev-for 一起使用并不令人困惑,你可以安全地禁用此规则。

¥If you don't find using v-else-if/v-else together with v-for confusing to read, you can safely disable this rule.

👫相关规则

¥👫 Related Rules

🚀版本

¥🚀 Version

此规则在 eslint-plugin-vue v9.16.0 中引入

¥This rule was introduced in eslint-plugin-vue v9.16.0

🔍代码实现

¥🔍 Implementation

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