index.js:8 [Vue Router warn]: The route named “ “ has a child without a name and an empty path. Usi

index.js:8  [Vue Router warn]: The route named " " has a child without a name and an empty path. Using that name won't render the empty path child so you probably want to move the name to the child instead. If this is intentional, add a name to the child route to remove the warning.

 [Vue Router warn]:名为"layout"的路由有一个没有名字的子路由和一个空路径。使用该名称不会呈现空路径子节点,因此您可能希望将名称移动到子节点。如果这是有意为之,可以在子路由中添加一个名称来删除警告。

  routes: [
    {
      path: '/',
      name: 'layout', //此时会报警告,将name属性删除即可
      component: Layout,
      children:[
        {
          path:'',
          component:Home
        },
        {
          path:'category',
          component:Category
        }
      ]
    },

原因是,父路由有name属性名字为layout,当使用name属性的值layout来跳转到这个页面时,二级路由中的path=" "的这个页面不会显示;为什么二级路由path为空?因为当为空的时候,使用路径跳转("/")时会将这个空路径二级页面也显示出来;

  • 7
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值