catherine-m

【报错】

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

运行时不报错,但是页面显示空白。打开控制台显示下图:

.

【报错解析】

路径/home的[vue router]route config“component”不能是字符串id 请改用实际的组件

在以下代码中定位,可以看到是组件的错误component

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

发现  component:'Profile' 不能加引号

【解决方法】

去掉引号(component:Profile)后界面即可正常显示。

 
posted on 2019-11-11 18:56 沙拉麻花 阅读(...) 评论(...) 编辑 收藏

分类:

技术点:

相关文章:

  • 2022-02-25
  • 2022-12-23
  • 2021-10-27
  • 2022-02-20
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
  • 2022-01-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
  • 2021-05-31
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案