在二级路由配置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'}
  }
]

标签: vue 路由

添加新评论