Vue报错:component has been registered but not used
原因:
eslint代码检查到你注册了组件但没有使用,然后就报错了。比如代码:
比如Vue中注册了File组件,而实际上却没有使用到(直接取消注册为好):
...
import File from "../../components/file";
export default {
components: {Pagination, File},
...
此时你可以取消注册即可,当然,有些时候我们并不想要取消,不更改代码,可以有两种解决办法:
方法一:
修改项目的package.json
在package.json中找到eslintConfig下的rules,增加"vue/no-unused-components": "off"即可:
"eslintConfig": {
"rules": {
"vue/no-unused-components": "off"
}
}
方法二:
如果项目中有eslintrc.js文件,也是一样添加上即可:
rules: {
"vue/no-unused-components": "off"
}
这两种使用其中任意一种都可以,修改好后重新启动一下项目,注意:如果两个文件都修改了的话,eslintrc.js文件的优先级更高。
Vue报错:component has been registered but not used的更多相关文章
- Vue报错——“Trailing spaces not allowed”
在VSCode中开发Vue 报错:“Trailing spaces not allowed” 这是空格多了,删除多余的空格就可以了
- vue 报错 :属性undefined(页面成功渲染)
vue 报错:Cannot read property 'instrumentId' of undefined" 相关代码如下: <template> ... <span& ...
- Vue 报错Error in render: “TypeError: Cannot read properties of null (reading ‘xxx’)” found in
前端vue报错 [Vue warn]: Error in render: "TypeError: Cannot read properties of null (reading 'name' ...
- Vue报错 type check failed for prop “xxx“. Expected String with value “xx“,got Number with value ‘xx‘
vue报错 [Vue warn]: Invalid prop: type check failed for prop "name". Expected String with ...
- Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol')
Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol') 报错信 ...
- vue报错[Vue warn]: Unknown custom element: <router-Link> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
vue浏览器报错,如下 vue.runtime.esm.js?2b0e:619 [Vue warn]: Unknown custom element: <router-Link> - di ...
- VUE编译报错 Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead
背景: 在使用VUE添加标签的时候编译报错,报错如下: Component template should contain exactly one root element. If you are u ...
- vue报错:Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.
在.vue文件中引入了 element-ui 的 table 和 pagination 组件后,报错:Component template should contain exactly one roo ...
- Do not use built-in or reserved HTML elements as component id:mask vue报错
今天学习了一下vue的组件,但是报了一个错误 Do not use built-in or reserved HTML elements as component id:mask , 经过查询得知是因 ...
- Vue报错之"[Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead......"
一.报错截图 [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the p ...
随机推荐
- leetcode之二叉树
专题:二叉树遍历 987. 二叉树的垂序遍历 给你二叉树的根结点 root ,请你设计算法计算二叉树的 垂序遍历 序列. 对位于 (row, col) 的每个结点而言,其左右子结点分别位于 (row ...
- Excel 工作簿、工作表与单元格
工作簿 工作簿是指在 Excel 中用来存储并处理数据的文件,其扩展名是.xlsx.工作簿是由工作表组成的,每一个工作簿都可以包含一个或多个工作表,默认为 3 个工作表.Excel 2007 之前的版 ...
- Java SE 15 新增特性
Java SE 15 新增特性 作者:Grey 原文地址:Java SE 15 新增特性 源码 源仓库: Github:java_new_features 镜像仓库: GitCode:java_new ...
- 检查一个数值是否为有限的Number.isFinite()
如果参数类型不是数值,Number.isFinite()一律返回false. Number.isFinite(15); // true Number.isFinite(0.8); // true Nu ...
- 【NOI P模拟赛】校门外歪脖树上的鸽子(树链剖分)
题面 2 ≤ n ≤ 2 × 1 0 5 , 1 ≤ m ≤ 2 × 1 0 5 , 1 ≤ l ≤ r ≤ n , 1 ≤ d ≤ 1 0 8 2 ≤ n ≤ 2 × 10^5,1 ≤ m ≤ 2 ...
- No value specified for parameter 5异常
No value specified for parameter 5 翻译:没有为参数5指定值 在sql语句中,有5个" ? "号,但是赋值的时候只赋了前面4个" ?&q ...
- APICloud AVM框架 封装车牌号输入键盘组件
AVM(Application-View-Model)前端组件化开发模式基于标准Web Components组件化思想,提供包含虚拟DOM和Runtime的编程框架avm.js以及多端统一编译工具,完 ...
- 第三十五篇:vue3,(组合式api的初步理解)
好家伙, 来一波核心概念:数据劫持是响应式的核心 1.由set up开始 (1)vue3中的一个新的配置项,值为一个函数. (2)组件中所用的到的:数据,方法,计算属性均要配置在set up中. (3 ...
- Openstack之各组件命令
openstack 组件命令 Glance组件操作(镜像服务组件) #环境配置: source /etc/keystone/admin-openrc.sh #查看镜像列表: glance image- ...
- Order Siblings by 排序
在层次查询中,如果想让"亲兄弟"按规矩进行升序排序就需要使用ORDER SIBLINGS BY 这个特定的排序语句,若要降序输出可以在其后添加DESC关键字. 通过这个实验给大家展 ...