vue-router dynamically add routing error

[Error]

Uncaught Error: 
[vue-router] route config "component" for path: /home cannot be a string id.
Use an actual component instead

No runtime error, but the page is blank. Open the console displays the following figure:

.

[A] error

Path / home of [vue router] route config "component" can be a string id please use the actual component

In the following code is positioned, the error can be seen that a component assembly

export default new Router({
  routes: [
    {
      path:'/',
      redirect:'/home'
    },
    {
      path:'/home',
      component:'Home'
    },
    {
      path:'/cart',
      component:'Cart'
    },
    {
      path:'/profile',
      component:'Profile'
    }
  ]
})

Discovery component: 'Profile' can not be quoted

【Solution】

Removing quotes: after (component Profile) screen to be displayed properly.

 

Guess you like

Origin www.cnblogs.com/catherine-m/p/11837504.html