原因:

​​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的更多相关文章

  1. Vue报错——“Trailing spaces not allowed”

    在VSCode中开发Vue 报错:“Trailing spaces not allowed” 这是空格多了,删除多余的空格就可以了

  2. vue 报错 :属性undefined(页面成功渲染)

    vue 报错:Cannot read property 'instrumentId' of undefined" 相关代码如下: <template> ... <span& ...

  3. 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' ...

  4. 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 ...

  5. Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol')

    Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol') 报错信 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. 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 , 经过查询得知是因 ...

  10. 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 ...

随机推荐

  1. xray+awvs的联动

    前言:xray是一款强大的漏扫工具,配合awvs的爬站功能可以十分轻松实现全自动挖洞,这里awvs我是使用的是12版本 1.启动xray,监听本地指定端口,这里我监听的是2222端口 命令:xray_ ...

  2. CobaltStrike插件编写(1)-权限维持

    自嘲:今天打开博客园一看,好家伙我竟然还有账户,原来我注册了博客园啊. CobaltStrike插件-权限维持模块 方法都是网上常见的,正好在学怎么写插件,练手之作,大佬勿喷. popup beaco ...

  3. 钓鱼利用-CVE-2018-20250

    钓鱼利用-CVE-2018-20250 漏洞影响版本 WinRAR < 5.70 Beta 1 Bandizip< = 6.2.0.0 好压(2345压缩) < = 5.9.8.10 ...

  4. js实现多条件排序

    1.sort排序允许接受一个参数(函数),这个函数接受2个形参a,b,并且通过冒泡的方式比较.例子:Arr.sort((a,b) => a-b);   升序排列Arr.sort((a,b) =& ...

  5. HPC+时代,携手亚马逊云科技,共赴数字化升级的星辰大海!

    高性能计算(HPC)和云计算曾是两个"平行世界",各自演绎着精彩,却鲜有交集. 传统上,HPC主要应用于大规模计算,如天气预报.石油勘探.药物研发等.这些任务通常借助超级计算机或计 ...

  6. electron 起步

    electron 起步 为什么要学 Electron,因为公司需要调试 electron 的应用. Electron 是 node 和 chromium 的结合体,可以使用 JavaScript,HT ...

  7. 使用Inno Setup 制作软件安装包详细教程(与开发语言无关)

    前言:关于如何制作一个软件安装包的教程,与编程语言无关.以下,请看详情~ 1.下载Inno Setup,下载地址:https://jrsoftware.org/isinfo.php 2.下载最新版本即 ...

  8. 【设计模式】Java设计模式 - 外观模式

    Java设计模式 - 外观模式 不断学习才是王道 继续踏上学习之路,学之分享笔记 总有一天我也能像各位大佬一样 原创作品,更多关注我CSDN: 一个有梦有戏的人 准备将博客园.CSDN一起记录分享自己 ...

  9. 【项目实战】pytorch实现逻辑斯蒂回归

    视频指导:https://www.bilibili.com/video/BV1Y7411d7Ys?p=6 一些数据集 在pytorch框架下,里面面有配套的数据集,pytorch里面有一个torchv ...

  10. 2.2 virtualenv 虚拟环境

    有的时候因为各种原因,在操作系统下,我们会安装很多版本的Python解释器.同样,我们也有可能因为各种原因,需要不同版本的模块,比如Django1.8,Django1.11.再加上pip工具管理器的版 ...