vue-super-call

1.0.0 • Public • Published

Vue Super Call

This is a simple library to call super in vuejs application

How to use in your project?

  • Install it by npm install vue-super-call
  • Add your main.js/index.js (entry file of your project) like following,
import VueSuperMethod from 'vue-super-call'

Vue.prototype.$super = VueSuperMethod

How to call super from method?

  • The basic syntax is this.$super(Mixin).yourMethod()
  • Proper example is following...
// This is mixin
export default {
    name: 'MyMixin',
    methods: {
        sayHello() {
            return "Hello"
        }
    }
}


// Your Component
export default {
    name: 'MyComponent',
    mixins: [MyMixin],
    methods: {
        sayHello() {
            let parentMethodData = this.$super(MyMixin).sayHello()
            console.log(parentMethodData)
            console.log('I\'m from component after super call')
        }
    }
}

// Console Output
$ Hello
$ I'm from component after super call

That's it :)

/vue-super-call/

    Package Sidebar

    Install

    npm i vue-super-call

    Weekly Downloads

    69

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    3.14 kB

    Total Files

    4

    Last publish

    Collaborators

    • _ashraful