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

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

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>
相关推荐
猫猫不是喵喵.8 分钟前
Vue3 Props 属性
前端·javascript·vue.js
醉城夜风~1 小时前
CSS元素显示模式(display)
前端·css
AI大模型-小华2 小时前
Codex 三方充值快速入门指南
java·前端·数据库·chatgpt·ai编程·codex·chatgpt pro
做前端的娜娜子4 小时前
同一链接实现 PC Web 与移动 H5 自适应
前端·掘金·金石计划
小帅不太帅4 小时前
架构没变、规模没变,DeepSeek V4 Flash 正式版凭什么暴涨 47 分?
前端·aigc·deepseek
jarvisuni5 小时前
DeepSeekFlash前端依旧拉垮,而且变慢了很多!
前端·javascript·算法
卷福同学6 小时前
AI编程出海第二步:验证关键词能否做站
前端·人工智能·后端
赵庆明老师6 小时前
Vben精讲:21-详解web-antd:tsconfig.json
前端·json·vim
wc886 小时前
微软EDGE浏览器功能学习
前端·学习·edge