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>
相关推荐
慧一居士28 分钟前
flex 布局完整功能介绍和示例演示
前端
DoraBigHead30 分钟前
小哆啦解题记——两数失踪事件
前端·算法·面试
一斤代码6 小时前
vue3 下载图片(标签内容可转图)
前端·javascript·vue
中微子6 小时前
React Router 源码深度剖析解决面试中的深层次问题
前端·react.js
光影少年6 小时前
从前端转go开发的学习路线
前端·学习·golang
中微子7 小时前
React Router 面试指南:从基础到实战
前端·react.js·前端框架
3Katrina7 小时前
深入理解 useLayoutEffect:解决 UI "闪烁"问题的利器
前端·javascript·面试
前端_学习之路8 小时前
React--Fiber 架构
前端·react.js·架构
coderlin_8 小时前
BI布局拖拽 (1) 深入react-gird-layout源码
android·javascript·react.js
伍哥的传说8 小时前
React 实现五子棋人机对战小游戏
前端·javascript·react.js·前端框架·node.js·ecmascript·js