Skip to content

Commit 721435a

Browse files
author
iamshaunjp
committed
added lesson 24 code
1 parent 87ea49b commit 721435a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/App.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div>
3-
<app-header v-bind:title="title"></app-header>
3+
<app-header v-bind:title="title" v-on:changeTitle="updateTitle($event)"></app-header>
44
<app-ninjas v-bind:ninjas="ninjas"></app-ninjas>
55
<ul>
66
<li v-for="ninja in ninjas">{{ ninja.name }}</li>
@@ -33,6 +33,11 @@ export default {
3333
],
3434
title: 'Vue Wizards'
3535
}
36+
},
37+
methods: {
38+
updateTitle: function(updatedTitle){
39+
this.title = updatedTitle;
40+
}
3641
}
3742
}
3843
</script>

src/components/Header.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default {
1818
},
1919
methods: {
2020
changeTitle: function(){
21-
this.title = 'Vue Ninjas';
21+
this.$emit('changeTitle', 'Vue Ninjas');
2222
}
2323
}
2424
}

0 commit comments

Comments
 (0)