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>
相关推荐
C澒几秒前
前端整洁架构(Clean Architecture)实战解析:从理论到 Todo 项目落地
前端·架构·系统架构·前端框架
C澒7 分钟前
Remesh 框架详解:基于 CQRS 的前端领域驱动设计方案
前端·架构·前端框架·状态模式
Charlie_lll10 分钟前
学习Three.js–雪花
前端·three.js
onebyte8bits27 分钟前
前端国际化(i18n)体系设计与工程化落地
前端·国际化·i18n·工程化
C澒36 分钟前
前端分层架构实战:DDD 与 Clean Architecture 在大型业务系统中的落地路径与项目实践
前端·架构·系统架构·前端框架
BestSongC39 分钟前
行人摔倒检测系统 - 前端文档(1)
前端·人工智能·目标检测
0思必得01 小时前
[Web自动化] Selenium处理滚动条
前端·爬虫·python·selenium·自动化
Misnice1 小时前
Webpack、Vite、Rsbuild区别
前端·webpack·node.js
青茶3601 小时前
php怎么实现订单接口状态轮询(二)
前端·php·接口
大橙子额2 小时前
【解决报错】Cannot assign to read only property ‘exports‘ of object ‘#<Object>‘
前端·javascript·vue.js