[Vue warn]: Invalid component name: “45095“. Component names should conform to valid custom element

问题描述:

在Vue项目开发过程中,出现了一个报错。

[Vue warn]: Invalid component name: "45095". Component names should conform to valid custom element name in html5 specification.

原因分析:

纯数字的命名导致的报错。

注:此报错一般发生在Vue的开发环境中,项目打包后就不会出现了。硬要改也是可以的。

解决方案:

根据项目的情况把命名改为非纯数字,或者直接去掉name属性。

改动前:

改动后:

这里是在前面加了个N,这样问题就可以解决了。

猜你喜欢

转载自blog.csdn.net/m0_51945510/article/details/129243776