Skip to content

Commit 87ea49b

Browse files
author
iamshaunjp
committed
added lesson 23 code
1 parent e9e1bc7 commit 87ea49b

File tree

4 files changed

+34
-7
lines changed

4 files changed

+34
-7
lines changed

src/App.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<template>
22
<div>
3-
<app-header></app-header>
3+
<app-header v-bind:title="title"></app-header>
44
<app-ninjas v-bind:ninjas="ninjas"></app-ninjas>
5-
<app-footer></app-footer>
5+
<ul>
6+
<li v-for="ninja in ninjas">{{ ninja.name }}</li>
7+
</ul>
8+
<app-footer v-bind:title="title"></app-footer>
69
</div>
710
</template>
811

@@ -27,7 +30,8 @@ export default {
2730
{name: 'Tango', speciality: 'Conditionals', show: false},
2831
{name: 'Kami', speciality: 'Webpack', show: false},
2932
{name: 'Yoshi', speciality: 'Data Diggin', show: false}
30-
]
33+
],
34+
title: 'Vue Wizards'
3135
}
3236
}
3337
}

src/components/Footer.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
<template>
22
<footer>
3-
<p>{{ copyright }}</p>
3+
<p>Copyright 2017 {{ title }}</p>
44
</footer>
55
</template>
66
<script>
77
export default {
8+
props: {
9+
title: {
10+
type: String,
11+
required: true
12+
}
13+
},
814
data(){
915
return{
10-
copyright: 'Copyright 2017 Vue Ninjas'
16+
1117
}
1218
}
1319
}

src/components/Header.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
<template>
22
<header>
3-
<h1>{{ title }}</h1>
3+
<h1 v-on:click="changeTitle">{{ title }}</h1>
44
</header>
55
</template>
66
<script>
77
export default {
8+
props: {
9+
title: {
10+
type: String,
11+
required: true
12+
}
13+
},
814
data(){
915
return{
10-
title: 'Vue Ninjas'
16+
1117
}
18+
},
19+
methods: {
20+
changeTitle: function(){
21+
this.title = 'Vue Ninjas';
22+
}
1223
}
1324
}
1425
</script>

src/components/Ninjas.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<h3 v-show="ninja.show">{{ ninja.speciality }}</h3>
77
</li>
88
</ul>
9+
<button v-on:click="deleteNinja">Delete a Ninja</button>
910
</div>
1011
</template>
1112
<script>
@@ -20,6 +21,11 @@ export default {
2021
return{
2122
2223
}
24+
},
25+
methods: {
26+
deleteNinja: function(){
27+
this.ninjas.pop();
28+
}
2329
}
2430
}
2531
</script>

0 commit comments

Comments
 (0)