vue/no-undef-components
禁止在
<template>
中使用未定义的组件
此规则报告在 <template>
中使用但未在 <script setup>
或 Options API 的 components
部分中定义的组件。
未定义的组件将从全局注册的组件中解析。但是,如果您没有使用全局组件,则可以使用此规则来防止运行时错误。
注意
此规则无法检查全局注册的组件和在 mixin 中注册的组件,除非您将它们添加为忽略模式的一部分。
🔧 选项
json
{
"vue/no-undef-components": ["error", {
"ignorePatterns": []
}]
}
ignorePatterns
如果组件名称与一个或多个模式匹配,则抑制所有错误。
ignorePatterns: ['custom(\\-\\w+)+']
👫 相关规则
🚀 版本
此规则在 eslint-plugin-vue v8.4.0 中引入