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,