Skip to content
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

activeMatch只生效于展开菜单内 #4163

Closed
4 tasks done
BlazeSnow opened this issue Aug 27, 2024 · 5 comments
Closed
4 tasks done

activeMatch只生效于展开菜单内 #4163

BlazeSnow opened this issue Aug 27, 2024 · 5 comments
Labels
bug: pending triage Maybe a bug, waiting for confirmation stale

Comments

@BlazeSnow
Copy link

Describe the bug

效果图如下

侧边栏选中第一个条目时,activeMatch正常显示于展开菜单以及导航栏

1

选中第二个及以后的条目时,activeMatch正常显示于展开菜单,但是不显示于导航栏

2

Reproduction

个人测试

经过测试,此现象与ASCII字符无关,使用/test/index.md/test/test.md也会出现此现象

源代码

nav

{

                text: '关于',

                items: [

                    {

                        text: '更新日志',

                        link: '/更新日志/',

                        activeMatch: '/更新日志/'

                    },

                    {

                        text: '关于本站',

                        link: '/about'

                    }

                ]

            }

sidebar

'/更新日志/': [

                {

                    text: '更新日志',

                    items: [

                        { text: '2024年8月', link: '/更新日志/' },

                        { text: '2024年7月', link: '/更新日志/2024年7月' },

                        { text: '2024年6月', link: '/更新日志/2024年6月' },

                        { text: '2024年5月', link: '/更新日志/2024年5月' },

                    ]

                }

            ],

Expected behavior

侧边栏选中任何条目时,activeMatch正常显示于展开菜单以及导航栏

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
    Memory: 7.42 GB / 15.69 GB
  Binaries:
    Node: 22.6.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    vitepress: ^1.3.4 => 1.3.4

Additional context

No response

Validations

@BlazeSnow BlazeSnow added the bug: pending triage Maybe a bug, waiting for confirmation label Aug 27, 2024
@github-actions github-actions bot added the stale label Sep 29, 2024
@BlazeSnow
Copy link
Author

此问题仍然未得到解决?我制作了一个示例网站来帮助理解此问题。

Is this issue still unresolved? I made a sample website to help understand this problem.

https://blazesnow-vitepressissue.vercel.app/

@Zhengqbbb
Copy link
Contributor

nav: [
      { text: 'Home', link: '/' },
      {
        text: 'Examples',
        activeMatch: '^/test',
        items: [
          {
            text: 'test',
            activeMatch: '^/test',
            link: '/test/',
          }
        ]
      }
    ],

@Zhengqbbb
Copy link
Contributor

CleanShot.2024-10-31.at.15.16.35.mp4

@BlazeSnow
Copy link
Author

感谢你的帮助,但是我注意到无论在Examples的activematch输入任何内容,test被高亮时,Examples总是会高亮。我已经将代码同步到示例网站。

Thank you for your help, but I've noticed that whenever test is highlighted, Examples are always highlighted no matter what you type in the Examples' activematch. I have synced the code to the sample site.

{
        text: 'Examples',
        activeMatch: '/whatever/',
        items: [
          {
            text: 'test',
            activeMatch: '/test/',
            link: '/test/',
          },
          {
            text: 'another',
            activeMatch: '/another/',
            link: '/another/',
          }
        ]
      },

@BlazeSnow
Copy link
Author

因为原本的问题已经解决,我将关闭此issue并提交新问题。

Since the original issue has been resolved, I will close this issue and submit a new one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: pending triage Maybe a bug, waiting for confirmation stale
Projects
None yet
Development

No branches or pull requests

10 participants
@Zhengqbbb @BlazeSnow and others