s8e114 centralizing the bus
This commit is contained in:
parent
7b299290de
commit
14320669eb
@ -13,7 +13,8 @@
|
|||||||
methods: {
|
methods: {
|
||||||
editAge(){
|
editAge(){
|
||||||
this.userAge = 30;
|
this.userAge = 30;
|
||||||
eventBus.$emit('ageWasEdited', this.userAge)
|
// eventBus.$emit('ageWasEdited', this.userAge)
|
||||||
|
eventBus.changeAge(this.userAge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
|
|
||||||
export const eventBus = new Vue();
|
export const eventBus = new Vue({
|
||||||
|
methods:{
|
||||||
|
changeAge(age){
|
||||||
|
this.$emit('ageWasEdited', age)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
new Vue({
|
new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
|
Loading…
Reference in New Issue
Block a user