s8e114 centralizing the bus

This commit is contained in:
Tyrel Souza 2018-04-17 22:05:07 -04:00
parent 7b299290de
commit 14320669eb
No known key found for this signature in database
GPG Key ID: 5A9394D4C30AEAC0
2 changed files with 9 additions and 2 deletions

View File

@ -13,7 +13,8 @@
methods: {
editAge(){
this.userAge = 30;
eventBus.$emit('ageWasEdited', this.userAge)
// eventBus.$emit('ageWasEdited', this.userAge)
eventBus.changeAge(this.userAge);
}
}
}

View File

@ -1,7 +1,13 @@
import Vue from '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({
el: '#app',