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 · 3 comments
Closed

Option to merge meta with parent route meta #3137

davNazaryan opened this issue Mar 3, 2020 · 3 comments

Comments

@davNazaryan
Copy link

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
Copy link
Member

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 as completed Mar 3, 2020
@mahammad-sixberries
Copy link

@posva is this published or not? and in which version?

@posva
Copy link
Member

posva commented Jul 13, 2020

There is an RFC on the RFCs repository and this is fixed in v4 because it's technically a breaking change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants