mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
fix(theme): incorrect resolve page path when sidebar matched
This commit is contained in:
parent
2443f99f46
commit
03b645e791
@ -95,6 +95,7 @@ export function getSidebar(routePath: string, routeLocal: string): ResolvedSideb
|
||||
return resolveSidebarItems(_sidebar, routeLocal)
|
||||
}
|
||||
else if (isPlainObject(_sidebar)) {
|
||||
routePath = decodeURIComponent(routePath)
|
||||
const dir
|
||||
= Object.keys(_sidebar)
|
||||
.sort((a, b) => b.split('/').length - a.split('/').length)
|
||||
|
||||
@ -93,8 +93,8 @@ function getAutoDirSidebar(
|
||||
|
||||
while (nowIndex < maxIndex) {
|
||||
pages = pages.sort((prev, next) => {
|
||||
const pi = prev.splitPath?.[nowIndex]?.match(/(\d+)\.(?=[^/]+$)/)?.[1]
|
||||
const ni = next.splitPath?.[nowIndex]?.match(/(\d+)\.(?=[^/]+$)/)?.[1]
|
||||
const pi = prev.splitPath?.[nowIndex]?.match(/(?:(\d+)\.)?(?=[^/]+$)/)?.[1]
|
||||
const ni = next.splitPath?.[nowIndex]?.match(/(?:(\d+)\.)?(?=[^/]+$)/)?.[1]
|
||||
if (!pi || !ni)
|
||||
return 0
|
||||
return Number.parseFloat(pi) < Number.parseFloat(ni) ? -1 : 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user