[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