vue/no-child-content
禁止元素的子内容被指令(如 `v-html` 或 `v-text`)覆盖
- ⚙️ 此规则包含在所有 `"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-html` 和 `v-text`,其他指令(例如Vue I18n 的 `v-t` 指令)可以手动配置。
🔧 选项
json
{
"vue/no-child-content": ["error", {
"additionalDirectives": ["foo"] // checks v-foo directive
}]
}
- `additionalDirectives` ... 要检查的其他指令数组,不带 `v-` 前缀。默认为空;始终检查 `v-html` 和 `v-text`。
📚 扩展阅读
🚀 版本
此规则是在 eslint-plugin-vue v8.1.0 版本中引入的。