Vue报错:component has been registered but not used

错误展示

报错原因:

eslint代码检查到你注册了组件但没有使用,然后就报错了。
比如Vue中注册了 ShopList组件,而实际上却没有使用到:

import ShopList from './components/ShopList.vue'
export default {name: 'App',components: {ShopList,},
}

此时你可以取消注册即可,当然,有些时候我们并不想要取消,不更改代码,可以有两种解决办法:

方法一

修改项目的package.json。

在package.json中找到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报错“Component name “School“ should always be multi-word”

    在vue.config.js文件添加下列代码 lintOnSave:false //关闭语法检查 完整代码 const { defineConfig } = require('@vue/cli-ser ...

  2. Vue报错 component lists rendered with v-for should have explicit keys.

    1.源代码 2.改后的代码 编译成功 2.v-for指令: 1.用于展示列表数据 2.语法:v-for="(item, index) in xxx" :key="yyy& ...

  3. Vue报错:Unknown custom element: router-view - did you register the component correctly页面中不显示链接

    Vue报错:Unknown custom element: router-view - did you register the component correctly vue-router应用到组件 ...

  4. 用vue-cli创建项目后npm run serve 报错Component name “main“ should always be multi-word vue/multi-word-compo

    1.报错 Component name "main" should always be multi-word vue/multi-word-component-names 原因: ...

  5. vue报错:Unknown custom element: <xxx> - did you register the component correctly?

    vue报错:Unknown custom element: - did you register the component correctly? For recursive components, ...

  6. VUE报错:Avoid mutating a prop directly since the value will be overwwritten whenever the parent及解决方案

    VUE报错: [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the p ...

  7. VUE报错__Avoid mutating a prop directly since the value will be overwritten whenever the parent

    1. vue报错: Avoid mutating a prop directly since the value will be overwritten whenever the parent com ...

  8. 【vue报错】【子组件改变父组件数据】 Avoid mutating a prop directly since

    [vue报错] Avoid mutating a prop directly since the value will be overwritten whenever the parent compo ...

  9. Vue报错:Error while running task D:\vue\forum:build with message‘spawn vue-cli-service ENOENT‘

    Vue报错:Error while running task D:\vue\vueforum\forum:build with message'spawn vue-cli-service ENOENT ...

最新文章

  1. 决策树 随机森林 xgboost_一文搞定XGboost 面试常见问题
  2. DES密码实现( C语言 )
  3. mysql 5.6 初始化_MySQL 5.6 关于登陆的初始化设置
  4. ubuntu18.04安装pytorch1.6
  5. 模式学习(1):Decorator装饰者模式
  6. Process Node.js 进程
  7. LVS调度算法权威讲解——官方文档翻译
  8. 微服务架构-设计总结
  9. Java获取计算机各类信息的方法(磁盘,系统,内存等等信息)
  10. linux下完全删除mysql
  11. 编译OpenJDK8:Target CPU mismatch. We are building for x86_64 but CL is for ; expected x64
  12. 互联网最强的下载工具:IDM
  13. deecamp考试题
  14. CAD中如何等分线段?CAD等分线段教程
  15. 根据FOV和图像大小计算相机内参[Python]
  16. 【图像增强】基于matlab Frangi滤波器血管图像增强【含Matlab源码 2108期】
  17. 逻辑回归(神经网络Sigmod激活函数,计量logit模型)
  18. oracle ORA-02292: 违反完整约束条件
  19. git pull --prune
  20. 再没时间 创业时也要读下这十本经典书

热门文章

  1. android系统语言切换及系统烧写默认语言设置
  2. 网络安全学习2个月,感觉什么都不会?
  3. 中国历代王朝疆域面积一览表
  4. python程序设计第二章序列类型 题库及选解
  5. twitter账号被冻结如何申诉,已成功解冻(我是第一次被冻结,听闻二次冻结会永久冻结)
  6. 80年代个人计算机,现在的电脑程序在80年代就已经有了
  7. Django REST framework+Vue 打造生鲜超市(四)
  8. CMD中Pushd和Popd命令的用法
  9. 你喜欢这个邮箱代码吗?用代码实现邮件的撰写和发送
  10. 网络管理之网络状态测试命令