From f1b2623ad3604d92fedaa67d74a54da20443c101 Mon Sep 17 00:00:00 2001 From: lyt <1105290566@qq.com> Date: Mon, 6 Jun 2022 22:22:16 +0800 Subject: [PATCH] =?UTF-8?q?'admin-22.06.06:=E6=B7=BB=E5=8A=A0=E5=A4=A7?= =?UTF-8?q?=E4=BD=AC=E9=9B=86=E6=88=90=E5=90=8E=E7=AB=AF=E9=93=BE=E6=8E=A5?= =?UTF-8?q?'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + src/router/route.ts | 32 +++++++++++++++----------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 68682cf..38087e3 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,7 @@ cnpm run build - @diygw.com gw-ui-php - @zsvg vboot-net - @zsvg vboot-java +- @青红造了个白 buildadmin #### ❤️ 鸣谢列表 diff --git a/src/router/route.ts b/src/router/route.ts index d833e93..e1563c4 100644 --- a/src/router/route.ts +++ b/src/router/route.ts @@ -16,6 +16,7 @@ import { RouteRecordRaw } from 'vue-router'; /** * 定义动态路由 + * 前端添加路由,请在顶级节点的 `children 数组` 里添加 * @description 未开启 isRequestRoutes 为 true 时使用(前端控制路由),开启时第一个顶级 children 的路由将被替换成接口请求回来的路由数据 * @description 各字段请查看 `/@/views/system/menu/component/addMenu.vue 下的 ruleForm` * @returns 返回路由菜单数据 @@ -168,11 +169,24 @@ export const notFoundAndNoPower = [ ]; /** - * 定义静态路由 + * 定义静态路由(默认路由) + * 此路由不要动,前端添加路由的话,请在 `dynamicRoutes 数组` 中添加 * @description 前端控制直接改 dynamicRoutes 中的路由,后端控制不需要修改,请求接口路由数据时,会覆盖 dynamicRoutes 第一个顶级 children 的内容(全屏,不包含 layout 中的路由出口) * @returns 返回路由菜单数据 */ export const staticRoutes: Array = [ + { + path: '/', + name: '/', + component: () => import('/@/layout/index.vue'), + meta: { + title: '布局界面', + }, + children: [ + // 请不要往这里 `children` 中添加内容,此内容为了防止 No match found for location with path "xxx" 问题 + ...notFoundAndNoPower, + ], + }, { path: '/login', name: 'login', @@ -181,20 +195,4 @@ export const staticRoutes: Array = [ title: '登录', }, }, - { - path: '/404', - name: 'notFound', - component: () => import('/@/views/error/404.vue'), - meta: { - title: '页面找不到', - }, - }, - { - path: '/401', - name: 'noPower', - component: () => import('/@/views/error/401.vue'), - meta: { - title: '页面无权限', - }, - }, ];