Appearance
vue/no-child-content
禁止元素的子内容被
v-html
或v-text
等指令覆盖
- ⚙️ 此规则包含在
"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"]
中。
💡此规则报告的某些问题可以通过编辑器 suggestions 手动修复。
¥💡 Some problems reported by this rule are manually fixable by editor suggestions.
📖 规则详情
此规则报告具有覆盖子内容的指令的元素的子内容。默认情况下,这些是 v-html
和 v-text
,其他的(例如 Vue I18n 的 v-t
指令)可以手动配置。
¥This rule reports child content of elements that have a directive which overwrites that child content. By default, those are v-html
and v-text
, additional ones (e.g. Vue I18n's v-t
directive) can be configured manually.
🔧选项
¥🔧 Options
json
{
"vue/no-child-content": ["error", {
"additionalDirectives": ["foo"] // checks v-foo directive
}]
}
additionalDirectives
...要检查的附加指令数组,不带v-
前缀。默认为空;始终检查v-html
和v-text
。¥
additionalDirectives
... An array of additional directives to check, without thev-
prefix. Empty by default;v-html
andv-text
are always checked.
📚扩展阅读
¥📚 Further Reading
🚀版本
¥🚀 Version
此规则在 eslint-plugin-vue v8.1.0 中引入
¥This rule was introduced in eslint-plugin-vue v8.1.0
🔍代码实现
¥🔍 Implementation