Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

call a function of another component vue

    ....
    mounted() {
        this.$root.$on('component1', () => {
            // your code goes here
            this.c1method()
        }
    }
Comment

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
    },
  }
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: last element of array 
Javascript :: JavaScript POSITIVE_INFINITY 
Javascript :: best node js orm for mysql 
Javascript :: javascript join address to string 
Javascript :: save file javascript 
Javascript :: byte to integer js 
Javascript :: pause console debugger in react 
Javascript :: how to add icons in angular 
Javascript :: new date 
Javascript :: jquery modal show 
Javascript :: compare date javascript 
Javascript :: react native conditional rendering 
Javascript :: angular 8 enable routing 
Javascript :: prettier printWidth 
Javascript :: recursion mdn 
Javascript :: usestate in react js 
Javascript :: async and await 
Javascript :: how to use data sets javascrip[t 
Javascript :: components in react 
Javascript :: get file css code with javascript 
Javascript :: radio button not checked 
Javascript :: set date to input date 
Javascript :: callback without duplicates javascript 
Javascript :: js do while loop 
Javascript :: export json to excel in javascript 
Javascript :: lodash remove not in array 
Javascript :: mongoose callback in save function 
Javascript :: select jquery display none 
Javascript :: javascript documentation 
Javascript :: json example list of objects 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =