Skip to content

Commit 8518562

Browse files
author
Shaun Pelling
committed
added lesson 35 code
1 parent 14aa9ab commit 8518562

File tree

2 files changed

+5
-21
lines changed

2 files changed

+5
-21
lines changed

src/components/showBlogs.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<template>
2-
<div v-theme:column="'narrow'" id="show-blogs">
2+
<div id="show-blogs">
33
<h1>All Blog Articles</h1>
44
<div v-for="blog in blogs" class="single-blog">
5-
<h2 v-rainbow>{{ blog.title }}</h2>
5+
<h2>{{ blog.title | to-uppercase }}</h2>
66
<article>{{ blog.body }}</article>
77
</div>
88
</div>

src/main.js

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,9 @@ import App from './App.vue'
55
// Use vue-resource package
66
Vue.use(VueResource);
77

8-
// Custom directives
9-
Vue.directive('rainbow', {
10-
bind(el, binding, vnode){
11-
el.style.color = "#" + Math.random().toString(16).slice(2, 8);
12-
}
13-
});
14-
15-
Vue.directive('theme', {
16-
bind(el, binding, vnode){
17-
if (binding.value == 'wide'){
18-
el.style.maxWidth = "1260px";
19-
} else if (binding.value = 'narrow'){
20-
el.style.maxWidth = "560px";
21-
}
22-
if(binding.arg == 'column'){
23-
el.style.background = '#ddd';
24-
el.style.padding = '20px';
25-
}
26-
}
8+
// Filters
9+
Vue.filter('to-uppercase', function(value){
10+
return value.toUpperCase();
2711
});
2812

2913
new Vue({

0 commit comments

Comments
 (0)