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

fix: better nav types #714

Merged
merged 3 commits into from
Jun 14, 2022
Merged

fix: better nav types #714

merged 3 commits into from
Jun 14, 2022

Conversation

zRains
Copy link

@zRains zRains commented Jun 4, 2022

Thanks for solving my problem before, but here I think a little change is needed.

VPMenuGroup.vue only one level of nesting is allowed:

<template>
  <div class="VPMenuGroup">
    <p v-if="text" class="title">{{ text }}</p>

    <template v-for="item in items">
      <VPMenuLink v-if="'link' in item" :item="item" />
    </template>
  </div>
</template>

But the type items: NavItem[] may be infinitely nested, the following Nav configuration code is allowed:

nav: [
    {
        text: 'Dropdown Menu',
        items: [
            {
                // Title for the section.
                text: 'Section A Title',
                items: [
                    { text: 'Section A Item 1', link: '...' },
                    { text: 'Section A Item 2', link: '...' },
                ],
            },
            {
                // Title for the section.
                text: 'Section B Title',
                items: [
                    { text: 'Section B Item 1', link: '...' },
                    {
                        text: 'Section B Item 2',
                        items: [
                            {
                                // Title for the section.
                                text: 'Section C Title',
                                items: [
                                    { text: 'Section C Item 1', link: '...' },
                                    { text: 'Section C Item 2', link: '...' },
                                ],
                            },
                        ],
                    },
                ],
            },
        ],
    },
]

It passed the type check.

@kiaking kiaking added types Related to typings only theme Related to the theme labels Jun 14, 2022
@kiaking kiaking merged commit 263607b into vuejs:main Jun 14, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
theme Related to the theme types Related to typings only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants