1Vue.component('component1', {
2 methods: {
3 c1method: function(){
4 alert('this is c1method')
5 },
6 }
7})
8Vue.component('component2', {
9 methods: {
10 c2method: function(){
11 component('component1').c1method()//like this
12 },
13 }
14})
15
1 ....
2 mounted() {
3 this.$root.$on('component1', () => {
4 // your code goes here
5 this.c1method()
6 }
7 }
8