[vue-router] route config "component" for path:canot be a string id. Use an actual compone


[vue-router] route config "component" for path:canot be a string id. Use an actual compone

标签:Use component 字符串 报错 组件 instead id

首先通过报错信息,我们分析如下:

  1. 和vue-router相关的

2.然后是配置组件的时候,config "component"

3.cannot be a string id,Use an actual component instead 不能是一个字符串id,用一个实际的组件代替

通过分析我们大概可以知道,是在配置组件的时候将组件写成了字符串形式,而应该是一个组件。

最后检查半天发现是在配置路由的时候,直接将

component: "MyComponent" //报错所在

写成了字符串的形式。

正确:

component: MyComponent //注意不是字符串形式,是别名


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM