组件已注册但未使用 vue/no-unused-components [英] component has been registered but not used vue/no-unused-components
本文介绍了组件已注册但未使用 vue/no-unused-components的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
创建我的组件 EmployeeTable.vue
然后我导出为
Created my component EmployeeTable.vue
Then I exported as
<script>
export default {
name: "employee-table"
};
</script>
但是当我在 App.vue
中导入它时,如下 import EmployeeTable from "@/components/EmployeeTable.vue";
我收到此错误
But when I import it in App.vue
as follows import EmployeeTable from "@/components/EmployeeTable.vue";
I get this error
error The "EmployeeTable" component has been registered but not used vue/no-unused-components
推荐答案
这是您的 es-lint 设置.您可以将其更改为不那么严格的规则,也可以解决此实际问题.1. 确保在 App.vue
中的组件部分中注册它,如下所示:
It's your es-lint setup. You can change it to not that strict rules or you can fix this actual problem.
1. Make sure that in App.vue
you registered it in a components section like this:
...
components: {
EmployeeTable
},
...
2.确保你在 App.vue
模板中使用了它:
2. Make sure you used it in App.vue
template:
<EmployeeTable />
这篇关于组件已注册但未使用 vue/no-unused-components的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文