[vue-router] route config "component" for path:canot be a string id. Use an actual compone
標簽:Use component 字符串 報錯 組件 instead id
首先通過報錯信息,我們分析如下:
- 和vue-router相關的
2.然后是配置組件的時候,config "component"
3.cannot be a string id,Use an actual component instead 不能是一個字符串id,用一個實際的組件代替
通過分析我們大概可以知道,是在配置組件的時候將組件寫成了字符串形式,而應該是一個組件。
最后檢查半天發現是在配置路由的時候,直接將
component: "MyComponent" //報錯所在
寫成了字符串的形式。
正確:
component: MyComponent //注意不是字符串形式,是別名