vue三级路由的写法

js 复制代码
{
    path: "/trafficmanagement",
    component: Layout,
    redirect: "/trafficmanagement",
    alwaysShow: true,
    meta: {
      title: "通行模块",
      icon: "excel",
    },
    children: [
        {
        path: "carline",
        name: "carline",
        alwaysShow: true,
        component: () => import("../views/trafficmanagement/carline"),
        meta: { title: "车行" },
        children: [
          {
            path: "carshopmanagement",
            component: () => import("@/views/trafficmanagement/carline/carshopmanagement"),
            name: "carshopmanagement",
            meta: { title: "车行管理", affix: true },
          },
          {
            path: "accessmanagement",
            component: () => import("@/views/trafficmanagement/carline/accessmanagement"),
            name: "accessmanagement",
            meta: { title: "进出管理", affix: true },
          },
        ],
      },
      {
        path: "peopline",
        name: "peopline",
        alwaysShow: true,
        component: () => import("../views/trafficmanagement/peopline"),
        meta: { title: "人行" },
        children: [
          {
            path: "peopconfig",
            component: () => import("@/views/trafficmanagement/peopline/peopconfig"),
            name: "peopconfig",
            meta: { title: "人行管理", affix: true },
          },
        ],
      },
    ],
  },

套了两层的children,其中在第二层套的时候,也就是车行的import 的指向是必须要有文件的,而不单单只是一个文件夹,必须要在这里再写一个出口才行。

文件截图如下:

carline文件以及peopline文件之下的index.vue内容就是又一层的路由出口

vue 复制代码
<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
export default {};
</script>

<style>
</style>
相关推荐
kyriewen6 小时前
Anthropic 估值逼近万亿美元,Claude Sonnet 5 + Claude Science 一天两连发
前端·ai编程·claude
小徐_23337 小时前
Wot UI 2.2.0 发布:Button 新增 subtle,VideoPreview 预览体验继续增强
前端·微信小程序·uni-app
山河木马9 小时前
矩阵专题3-怎么创建投影矩阵(uProjectionMatrix)
javascript·webgl·计算机图形学
天蓝色的鱼鱼10 小时前
关于 CSS 你可能不知道的属性,但关键时刻很有用
前端·css
泯泷10 小时前
第 2 篇:设计第一套字节码:Opcode、Instruction 与 Constant Pool
前端·javascript·安全
妙码生花10 小时前
从 PHP 到 AI + Golang,程序员自救转型手记(十五):优化细节、网络请求封装
前端·后端·ai编程
泯泷11 小时前
第 1 篇:从 1 + 2 开始:亲手写出第一台 JSVM
前端·javascript·安全
团团崽_七分甜11 小时前
Spring Boot 核心知识点总结
前端
lichenyang45311 小时前
从一个按钮开始,理解 ASCF 框架到底在做什么
前端