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

is "metaInfo", at a "SubClass" level, supposed to be merged with a "SuperClass" component's "metaInfo"? #172

Closed
akhoury opened this issue Dec 12, 2017 · 2 comments

Comments

@akhoury
Copy link

akhoury commented Dec 12, 2017

Right now the whole metaInfo object gets overwritten.

Example code:

var SuperClass = Vue.extend({
    metaInfo: {
        titleTemplate: '%s - MyCompany'
    }
});

var SubClass = Vue.extend({
    // using this option: https://vuejs.org/v2/api/#extends
    extends: SuperClass, 

    metaInfo: {
        title: 'Home Page'
    }
}); 

var app = new SubClass({
    el: '#app'    
});

console.log( app.$options.metaInfo );
/// { title: "Home Page" }

Live example code:

Use case

It's nice to have a Page superclass component that all the other "pages" (pages, and not all the other "components") extends, this way we can have a titleTemplate for all, and each page would just override the title property.

Thanks

@pimlie
Copy link
Collaborator

pimlie commented Mar 7, 2019

Isnt this wat mixins are for in Vue? So I'd propose to close this issue as the above pattern just wont be possible in Vue v2 afaik. I'll leave the closing to @manniL if he agrees, he might have a possible solution for this

@manniL
Copy link
Member

manniL commented Mar 7, 2019

@akhoury This was added but had been removed since because it caused issues (see #273 and following).

@manniL manniL closed this as completed Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants