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

Option to merge meta with parent route meta #3137

Closed
davNazaryan opened this issue Mar 3, 2020 · 1 comment
Closed

Option to merge meta with parent route meta #3137

davNazaryan opened this issue Mar 3, 2020 · 1 comment

Comments

@davNazaryan
Copy link

@davNazaryan davNazaryan commented Mar 3, 2020

What problem does this feature solve?

Add an option mergeParentMeta: [Boolean] to give the ability to merge route meta with its parent route meta directly in routes.js
mergeParentMeta-s default value is false. The priority of the child must be higher than the parent.

What does the proposed API look like?

{
        path: '/report',
        name: 'report',
        redirect: { name: 'report/workspace' },
        component: { render(c) { return c('router-view'); } },
        meta: {
          breadcrumbs: {
            name: 'Reports',
          },
          layout: {
            headerMenu: true,
          },
          menuItems: [
            { name: 'Banners', to: 'report/banner' },
            { name: 'Campaigns', to: 'report/campaign' },
            { name: 'Workspaces', to: 'report/workspace' },
          ],
        },
        children: [
          {
            path: '/report/workspace',
            ...component('report/list/List', 'report/workspace'),
            mergeParentMeta: true,
            meta: {
              breadcrumbs: {
                crumbs: [
                  { name: 'Reports', route: 'report', title: 'Reports' },
                ],
                name: 'Workspaces',
              },
            },
          },
          {
            path: '/report/campaign',
            ...component('report/list/List', 'report/campaign'),
            mergeParentMeta: true,
            meta: {
              breadcrumbs: {
                crumbs: [
                  { name: 'Reports', route: 'report', title: 'Reports' },
                ],
                name: 'Campaigns',
              },
            },
          },
        ],
      },

In this case, the menuItems meta can be used inside report\workspace and report\campaign routes.

@posva

This comment has been minimized.

Copy link
Member

@posva posva commented Mar 3, 2020

The truth is I have an RFC almost ready about always (I don't think it should be an option) merging the meta from parent to child. Like Nuxt does, I believe
I don't think it should go through an option, it should be a default. But all of this will be on the RFC I will publish next week :)

@posva posva closed this Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.