calling a parent function from a child component raises an error in vuejs

You shouldn’t call parent method using this.$parent.someMethod() but you have to emit a custom event from child component to the parent one which has the parent method as handler :

   <AddInstrumentDrawer 
     @append-instrument="appendinstrument"

     :add_instrument_drawer_watcher="add_instrument_drawer_watcher"></AddInstrumentDrawer>

in child component :

    methods: {
        test() {
            this.$emit('append-instrument','test');
        },
    },

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top