Skip to content

Commit 76c72f1

Browse files
Merge pull request #1 from yocdev/fix/h5-custom-routes-210809
修复 生成的路由别名带上特殊前缀的问题
2 parents efc44c0 + 0c27720 commit 76c72f1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/routes/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ export default function generateRoutes() {
9191
routes.source[name] = routeUsefulPath;
9292
routes.routeMap[name] = `/${routeUsefulPath}`;
9393
const shortLink = name.replace(/([A-Z])/g, "-$1").toLowerCase();
94-
routes.customRoutes[`/${routeUsefulPath}`] = `/${shortLink}`;
94+
routes.customRoutes[`/${routeUsefulPath}`] =
95+
`/${shortLink.startsWith('-') ? shortLink.slice(1) : shortLink}`;
9596
routes.names.push(name);
9697
routes.pages = moveHomeToFirst(routes.pages)
9798
}

0 commit comments

Comments
 (0)