在二级路由配置redirect:'/reconciliation/list',也就是增加个redirect的指向就可以了

vue-router.png

示例代码:

const admin = [
  {
    path: '/',
    name: 'index',
    component: (resolve) => require(['@/page/index'], resolve),
    children: [
      {
        path: '/',
        redirect: 'fixManage'
      },
      {
        path: '/fixManage',
        name: 'fixManage',
        meta: {title: '推修管理', auth: false},
        component: (resolve) => require(['@/page/fixManage'], resolve),//映射的组件
      },
      {
        path: '/reconciliation', //二级路由
        name: 'reconciliation',
        meta: {title: '对账结算'},
        redirect:'/reconciliation/list',
        component: (resolve) => require(['@/page/reconciliation'], resolve),//映射的组件
        children: [
          {//三级路由
            path: 'list',
            name: 'reconciliationList',
            meta: {activeName: 'reconciliation'},
            component: resolve => require(['@/page/reconciliation/list'], resolve)
          },
          {
            path: 'fix',
            name: 'reconciliationFix',
            meta: {activeName: 'reconciliation'},
            component: resolve => require(['@/page/reconciliation/reconciliationFix'], resolve)
          },
        ]
      }
    ]
  },

  {
    path: '/list',
    name: 'list',
    component: (resolve) => require(['@/page/list'], resolve),//映射的组件
    meta: {title: 'list'}
  },
  {
    path: '/login',
    name: 'login',
    component: (resolve) => require(['@/page/login'], resolve),//映射的组件
    meta: {title: 'login'}
  }
]

版权声明:本文为李维亮博主的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:http://www.liweiliang.com/978.html

标签: vue 路由

仅有一条评论

  1. 丽丽 丽丽

    没有生效

评论已关闭