Commit 1ef6016d9ddc20893d8c8b3c9be519671c866fb2
1 parent
ec0bb01e
perf: 路由子集显示可配置
Showing
4 changed files
with
12 additions
and
3 deletions
yudao-ui-admin-vue3/.env
yudao-ui-admin-vue3/src/utils/routerHelper.ts
| @@ -57,7 +57,12 @@ export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecord | @@ -57,7 +57,12 @@ export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecord | ||
| 57 | icon: route.icon, | 57 | icon: route.icon, |
| 58 | hidden: !route.visible, | 58 | hidden: !route.visible, |
| 59 | noCache: !route.keepAlive, | 59 | noCache: !route.keepAlive, |
| 60 | - alwaysShow: route.children && route.children.length == 1 ? true : false | 60 | + alwaysShow: |
| 61 | + route.children && | ||
| 62 | + route.children.length === 1 && | ||
| 63 | + import.meta.env.VITE_ROUTE_ALWAYSSHOW_ENABLE === 'true' | ||
| 64 | + ? true | ||
| 65 | + : false | ||
| 61 | } | 66 | } |
| 62 | // 路由地址转首字母大写驼峰,作为路由名称,适配keepAlive | 67 | // 路由地址转首字母大写驼峰,作为路由名称,适配keepAlive |
| 63 | let data: AppRouteRecordRaw = { | 68 | let data: AppRouteRecordRaw = { |
yudao-ui-admin-vue3/types/env.d.ts
| @@ -10,7 +10,8 @@ declare module '*.vue' { | @@ -10,7 +10,8 @@ declare module '*.vue' { | ||
| 10 | interface ImportMetaEnv { | 10 | interface ImportMetaEnv { |
| 11 | readonly VITE_APP_TITLE: string | 11 | readonly VITE_APP_TITLE: string |
| 12 | readonly VITE_PORT: number | 12 | readonly VITE_PORT: number |
| 13 | - readonly VITE_OPEN: boolean | 13 | + readonly VITE_OPEN: string |
| 14 | + readonly VITE_ROUTE_ALWAYSSHOW_ENABLE: string | ||
| 14 | readonly VITE_APP_CAPTCHA_ENABLE: string | 15 | readonly VITE_APP_CAPTCHA_ENABLE: string |
| 15 | readonly VITE_APP_TENANT_ENABLE: string | 16 | readonly VITE_APP_TENANT_ENABLE: string |
| 16 | readonly VITE_BASE_URL: string | 17 | readonly VITE_BASE_URL: string |
yudao-ui-admin-vue3/vite.config.ts
| @@ -30,7 +30,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { | @@ -30,7 +30,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { | ||
| 30 | // 端口号 | 30 | // 端口号 |
| 31 | port: env.VITE_PORT, | 31 | port: env.VITE_PORT, |
| 32 | host: "0.0.0.0", | 32 | host: "0.0.0.0", |
| 33 | - open: env.VITE_OPEN, | 33 | + open: env.VITE_OPEN === 'true', |
| 34 | // 本地跨域代理 | 34 | // 本地跨域代理 |
| 35 | proxy: { | 35 | proxy: { |
| 36 | ['/admin-api']: { | 36 | ['/admin-api']: { |