From c01bdf9a4190073846b4b6cfa925c66ee2598b65 Mon Sep 17 00:00:00 2001 From: jingrow Date: Fri, 21 Nov 2025 17:40:37 +0800 Subject: [PATCH] Use tool_name for route generation and convert underscores to hyphens --- .../jingrow/frontend/src/shared/utils/dynamicRoutes.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/jingrow/frontend/src/shared/utils/dynamicRoutes.ts b/apps/jingrow/frontend/src/shared/utils/dynamicRoutes.ts index 39b2917..a3ab0c3 100644 --- a/apps/jingrow/frontend/src/shared/utils/dynamicRoutes.ts +++ b/apps/jingrow/frontend/src/shared/utils/dynamicRoutes.ts @@ -11,11 +11,12 @@ function generateRouteName(toolName: string): string { } function generateRoutePath(toolName: string): string { - return `tools/${toolName}` + const pathName = toolName.replace(/_/g, '-') + return `tools/${pathName}` } export function ensureToolRoutes(tool: Tool): Tool { - const routeNameBase = tool.marketplaceId || tool.name || tool.id + const routeNameBase = tool.toolName || tool.marketplaceId || tool.name || tool.id const routePathBase = tool.toolName || tool.marketplaceId || tool.name || tool.id if (!tool.routeName) { @@ -52,7 +53,10 @@ export function registerToolRoute( const toolDirName = toolWithRoutes.toolName || toolWithRoutes.id finalComponentPath = `../../views/tools/${toolDirName}/${toolDirName}.vue` } - const routePath = toolWithRoutes.routePath || `tools/${toolWithRoutes.toolName || toolWithRoutes.id}` + const routePath = toolWithRoutes.routePath || (() => { + const toolDirName = toolWithRoutes.toolName || toolWithRoutes.id + return `tools/${toolDirName.replace(/_/g, '-')}` + })() const route: RouteRecordRaw = { path: routePath,