Skip to content

Commit 4aae64e

Browse files
committed
fix: route level default value
1 parent c39ac61 commit 4aae64e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

client/src/utils/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,5 +199,6 @@ export function getFirstLevelRoute(path) {
199199
const secondSlashIndex = path.indexOf('/', firstSlashIndex + 1);
200200

201201
// 如果没有找到第二个斜杠,说明路径只有一级
202-
return secondSlashIndex === -1 ? path : path.slice(0, secondSlashIndex);
202+
const finalPath = secondSlashIndex === -1 ? path : path.slice(0, secondSlashIndex);
203+
return finalPath || '/';
203204
}

0 commit comments

Comments
 (0)