feat: 根据环境变量控制是否显示 /demos 开头的路由
All checks were successful
CI/CD Pipeline / playwright (push) Successful in 4m11s
CI/CD Pipeline / build-and-deploy (push) Successful in 4m20s

This commit is contained in:
严浩
2025-10-23 13:38:45 +08:00
parent a8b340403d
commit 4e43500084
2 changed files with 5 additions and 0 deletions

1
.env
View File

@@ -4,3 +4,4 @@ VITE_APP_BUILD_SOURCE_MAP=true
VITE_APP_BUILD_COMMIT=
VITE_APP_BUILD_TIME=
VITE_ENABLE_VUE_DEVTOOLS=true
VITE_MENU_SHOW_DEMOS=true

View File

@@ -20,6 +20,10 @@ function convertRoutesToMenuOptions(routes: Readonly<RouteRecordRaw[]>): MenuOpt
if (route.path.includes('*')) {
return false;
}
// 根据环境变量判断是否显示 /demos 开头的路由
if (route.path.startsWith('/demos') && import.meta.env.VITE_MENU_SHOW_DEMOS !== 'true') {
return false;
}
return true;
})
.sort((a, b) => a.path.localeCompare(b.path));