component路径写法错误,[vue-router] route config "component" for path: /content cannot be a string id.

原因:compontent因为不正确。 错误写法:

routes: [
      {
        //路由路径
        path: '/content',
        name: 'content',
        //跳转的路径
        component: 'Content'//错误写法,不能加引号
      },
      {
        //路由路径
        path: '/main',
        name: 'main',
        //跳转的路径
        component: 'Main'//错误写法,不能加引号
      }
  ]

去掉引号后页面正常显示

posted @ 2021-11-28 14:50  一指大人  阅读(1772)  评论(0)    收藏  举报