问题描述:
在Vue项目开发过程中,出现了一个报错。
![](https://i-blog.csdnimg.cn/blog_migrate/5e6c50305d010e12efec54fc243643ca.png)
[Vue warn]: Invalid component name: "45095". Component names should conform to valid custom element name in html5 specification.
原因分析:
纯数字的命名导致的报错。
注:此报错一般发生在Vue的开发环境中,项目打包后就不会出现了。硬要改也是可以的。
解决方案:
根据项目的情况把命名改为非纯数字,或者直接去掉name属性。
改动前:
![](https://i-blog.csdnimg.cn/blog_migrate/a6ffb26e0d27c7fbd14f61a61450dfff.png)
改动后:
![](https://i-blog.csdnimg.cn/blog_migrate/1aa994b6d37b12181068478fb422a637.png)
这里是在前面加了个N,这样问题就可以解决了。