[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 //注意不是字符串形式,是别名

原文地址:https://www.cnblogs.com/Xieyingpeng/p/15149884.html