Skip to content

Vue.js plugin that allows you to reference methods on parent classes

License

Notifications You must be signed in to change notification settings

rpkilby/vue-super

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-super

Build Status codecov Version

Provides a $super handler for accessing parent vue methods from a subclass. Behaves similarly to python's super implementation.

vue-super is tested against both vue@1 and vue@2

Example:

const Parent = Vue.extend({
    methods: {
        doTheThing: function(){
            console.log('performing a parental action');
        },
    },
})

const Child = Parent.extend({
    methods: {
        doTheThing: function() {
            this.$super(Child, this).doTheThing();
            console.log('doing a childlike thing');
        },
    },
})

For convenience, methods are directly accessible on the $super object. However, this behavior is only valid on a final subclass.

const Final = Child.extend({
    methods: {
        doTheThing: function() {
            this.$super.doTheThing();
            console.log('doing the final thing');
        },
    },
})

About

Vue.js plugin that allows you to reference methods on parent classes

Resources

License

Stars

Watchers

Forks

Packages

No packages published