Vue报错:component has been registered but not used
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相关推荐
- Vue报错“Component name “School“ should always be multi-word”
在vue.config.js文件添加下列代码 lintOnSave:false //关闭语法检查 完整代码 const { defineConfig } = require('@vue/cli-ser ...
- 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& ...
- 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应用到组件 ...
- 用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 原因: ...
- vue报错:Unknown custom element: <xxx> - did you register the component correctly?
vue报错:Unknown custom element: - did you register the component correctly? For recursive components, ...
- 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 ...
- 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 ...
- 【vue报错】【子组件改变父组件数据】 Avoid mutating a prop directly since
[vue报错] Avoid mutating a prop directly since the value will be overwritten whenever the parent compo ...
- 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 ...
最新文章
- 决策树 随机森林 xgboost_一文搞定XGboost 面试常见问题
- DES密码实现( C语言 )
- mysql 5.6 初始化_MySQL 5.6 关于登陆的初始化设置
- ubuntu18.04安装pytorch1.6
- 模式学习(1):Decorator装饰者模式
- Process Node.js 进程
- LVS调度算法权威讲解——官方文档翻译
- 微服务架构-设计总结
- Java获取计算机各类信息的方法(磁盘,系统,内存等等信息)
- linux下完全删除mysql
- 编译OpenJDK8:Target CPU mismatch. We are building for x86_64 but CL is for ; expected x64
- 互联网最强的下载工具:IDM
- deecamp考试题
- CAD中如何等分线段?CAD等分线段教程
- 根据FOV和图像大小计算相机内参[Python]
- 【图像增强】基于matlab Frangi滤波器血管图像增强【含Matlab源码 2108期】
- 逻辑回归(神经网络Sigmod激活函数,计量logit模型)
- oracle ORA-02292: 违反完整约束条件
- git pull --prune
- 再没时间 创业时也要读下这十本经典书