PanJiaChen / vue-element-admin

:tada: A magical vue admin https://panjiachen.github.io/vue-element-admin
MIT License
87.73k stars 30.43k forks source link

面包屑导航实现子路由之间的跳转无需新打开tagViews #1352

Open keyiwu opened 5 years ago

keyiwu commented 5 years ago

// 活动管理 { path: '/activity', redirect: '/activity/index', component: Layout, children: [{ path: 'index', component: () => import('@/views/activity/index'), name: 'activityIndex', meta: { title: '活动管理', icon: 'dashboard', noCache: true } }] }, { path: '/activity', component: Layout, redirect: '/activity/index', name: 'activity', hidden: true, meta: { title: '活动管理', icon: 'dashboard', noCache: true }, children: [{ path: 'add', component: () => import('@/views/activity/components/add'), name: 'activityAdd', meta: { title: '活动添加', noCache: true } }, { path: 'edit/:id(\d+)', component: () => import('@/views/activity/components/edit'), name: 'activityEdit', meta: { title: '活动修改', noCache: true }, hidden: true }, //详情页面 { path: 'detail/:id(\d+)', hidden: true, component: () => import('@/views/activity/components/detail'), name: 'activityDetail', meta: { title: '活动详情', icon: 'star', noCache: true } } ] } 侧边导航只会显示一个,右侧不同子路由的切换,不会新增新的tagViews,实现了 “首页/父路由/子路由1”到“首页/父路由/子路由2”的切换,切换的同时关闭子路由1,有没有可能实现模拟浏览器的后退按钮,后退就直接返回上次的路由

PanJiaChen commented 5 years ago

可以增加一个变量来控制,有些页面新开不添加 tagsview。