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

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

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>
相关推荐
上海合宙LuatOS29 分钟前
LuatOS核心库API——【io】 io操作(扩展)
java·服务器·前端·网络·单片机·嵌入式硬件·物联网
GISer_Jing2 小时前
Taro多端开发
前端·react.js·taro
未来龙皇小蓝2 小时前
RBAC前端架构-04:设置代理及开发配置
前端·vue.js
祈安_2 小时前
深入理解指针(一)
c语言·前端
SuperEugene2 小时前
对象数组的排序与分组:sort / localeCompare / 自定义 compare
前端·javascript·面试
扶苏10023 小时前
“解构”与“响应”的博弈——深入剖析 Vue 3 的 toRef 与 toRefs
前端·javascript·vue.js
icestone20004 小时前
使用Cursor开发大型项目的技巧
前端·人工智能·ai编程
Channing Lewis4 小时前
zoho crm的子表添加行时,有一个勾选字段,如何让它在details页面新建子表行(点击add row)时默认是勾选的
开发语言·前端·javascript
董员外5 小时前
LangChain.js 快速上手指南:模型接入、流式输出打造基础
前端·javascript·后端
AomanHao5 小时前
基于高德地图JS的旅游足迹,可嵌入个人博客中
前端