Skip to content

Commit 1b82e9d

Browse files
author
Shaun Pelling
committed
added lesson 37 code
1 parent 9c1c6a0 commit 1b82e9d

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/components/showBlogs.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<h1>All Blog Articles</h1>
44
<input type="text" v-model="search" placeholder="search blogs" />
55
<div v-for="blog in filteredBlogs" class="single-blog">
6-
<h2>{{ blog.title | to-uppercase }}</h2>
6+
<h2 v-rainbow>{{ blog.title | toUppercase }}</h2>
77
<article>{{ blog.body }}</article>
88
</div>
99
</div>
@@ -31,6 +31,21 @@ export default {
3131
return blog.title.match(this.search);
3232
});
3333
}
34+
},
35+
filters: {
36+
/*'to-uppercase': function(value){
37+
return value.toUpperCase();
38+
}*/
39+
toUppercase(value){
40+
return value.toUpperCase();
41+
}
42+
},
43+
directives: {
44+
'rainbow' :{
45+
bind(el, binding, vnode){
46+
el.style.color = "#" + Math.random().toString(16).slice(2, 8);
47+
}
48+
}
3449
}
3550
}
3651
</script>

src/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import App from './App.vue'
66
Vue.use(VueResource);
77

88
// Filters
9+
/*
910
Vue.filter('to-uppercase', function(value){
1011
return value.toUpperCase();
11-
});
12+
}); */
1213

1314
new Vue({
1415
el: '#app',

0 commit comments

Comments
 (0)