Answers for "call a function of another component vue"

0

how to call function from another component in vue js

Vue.component('component1', {
  methods: {
    c1method: function(){
     alert('this is c1method')
    },
  }
})
Vue.component('component2', {
  methods: {
    c2method: function(){
     component('component1').c1method()//like this
    },
  }
})
Posted by: Guest on September-01-2021
0

call a function of another component vue

....
    mounted() {
        this.$root.$on('component1', () => {
            // your code goes here
            this.c1method()
        }
    }
Posted by: Guest on September-05-2021

Code answers related to "call a function of another component vue"

Code answers related to "Javascript"

Browse Popular Code Answers by Language