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'//错误写法,不能加引号
      }
  ]

去掉引号后页面正常显示


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM