一个菜单两个二级路由的搭建

效果如下,而且这是最上方的菜单,需要进入以后重定向。

TypeScript 复制代码
  {
    path: '/',
    name: 'HOME',
    component: ConsoleLayout, //这里也有router-view
    meta: {
      menu: false
    },
    redirect: {
      name: 'ManagerList'
    },
    children: [
      {
        path: '/rightsManage',
        name: 'RightsManage',
        component: () => import('@/views/AdminConsole/rightsManage/index.vue'),
        meta: {
          menu: true,
          title: '权限管理'
        },
        children: [
              {
              path: '/managerList',
              name: 'ManagerList',
              component: () => import('@/views/AdminConsole/rightsManage/manager.vue'),
              meta:
               {
                menu: true,
                title: '管理员列表'
               }
              },
              {
                path: '/operationLogs',
                name: 'OperationLogs',
                component: () => import('@/views/AdminConsole/rightsManage/operationLogs.vue'),
                meta:
                 {
                  menu: true,
                  title: '操作日志'
                 }
              },
           ]
        }
     ]
  },

注意,这里需要children里套children,index.vue里面的内容如下,需要给路由一个入口。

html 复制代码
<script setup lang="ts"></script>
<template>
  <router-view></router-view>
</template>
相关推荐
anOnion10 小时前
构建无障碍组件之Menu Button pattern
前端·html·交互设计
用户479492835691511 小时前
claude Fable用不了?把Gpt 5.5pro接到你的claude code里
前端·后端
zhangxingchao13 小时前
Kotlin常用的Flow 操作符整理
前端
IT_陈寒15 小时前
React的useState居然还有这种坑?我差点删库跑路
前端·人工智能·后端
Pedantic16 小时前
SwiftUI 手势笔记
前端·后端
橙子家16 小时前
浏览器缓存之【结构化数据库与缓存】: IndexedDB、Cache storage 和 Storage buckets
前端
user205855615181316 小时前
X6 中边悬浮置顶,规避 `mouseleave` 事件丢失问题
前端
李明卫杭州16 小时前
CSS aspect-ratio 属性完全指南
前端
Pedantic18 小时前
SwiftUI 手势层级(Gesture Hierarchy)详解
前端