-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] sidebar : switching pages collapsed
sidebar items NOT expand
#3613
Comments
sidebar: {
'/foo': [
{
text: 'hello',
collapsed: true,
items: [
{
text: 'a',
link: '/foo/a',
},
{
text: 'b',
link: '/foo/b',
},
],
},
],
'/bar': [
{
- text: 'hello',
+ text: 'hello 2',
collapsed: true,
items: [
{
text: 'a',
link: '/bar/a',
},
{
text: 'b',
link: '/bar/b',
},
],
},
],
}, |
What you want to express is that |
I tried to use the sidebar match value to add to the outermost export function getSidebarMatchPath(
sidebar: DefaultTheme.Sidebar | undefined,
_path: string
): string {
if (Array.isArray(sidebar) || sidebar == null) return ''
const path = ensureStartingSlash(_path)
return Object.keys(sidebar).find((key) => {
return path.startsWith(ensureStartingSlash(key))
}) || ''
} - <div v-for="item in sidebarGroups" :key="item.text" class="group">
+ <div v-for="item in sidebarGroups" :key="sidebarMatchPath + item.text" class="group"> |
Can I offer help, such as testing or PR ? or have any other think? |
Describe the bug
switching pages
collapsed
sidebar items NOT expandReproduction
https://stackblitz.com/edit/vite-bvmtz6?file=docs%2F.vitepress%2Fconfig.ts
Arc.mp4
Expected behavior
auto expand
collapsed
sidebar items when switching pagesSystem Info
Additional context
It should be caused by recent changes, and the previous version was normal.
Validations
The text was updated successfully, but these errors were encountered: