<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.27/vue.min.js"></script>
<section id="js-grid-list" class="grid-list" v-cloak>
<div class="tool-bar">
<!-- These link buttons use Vue.js to bind click events to change the "layout" variable and bind an active class -->
<a class="list-icon" v-on:click="layout = 'list'" v-bind:class="{ 'active': layout == 'list'}" title="List"></a>
<a class="grid-icon" v-on:click="layout = 'grid'" v-bind:class="{ 'active': layout == 'grid'}" title="Grid"></a>
</div>
<!-- Vue.js lets us choose which UL to show depending on the "layout" variable -->
<ul v-if="layout === 'grid'" class="grid">
<!-- A "grid" view with photos only -->
<li v-for="blog in blog_posts">
<a v-bind:href="blog.url" v-bind:style="{ backgroundImage: 'url(' + blog.image.large + ')' }" target="_blank"></a>
</li>
</ul>
<ul v-if="layout === 'list'" class="list">
<!-- A "list" view with small photos and blog titles -->
<li v-for="blog in blog_posts">
<a v-bind:href="blog.url" target="_blank">
<img v-bind:src="blog.image.small">
<p>{{blog.title}}</p>
</a>
</li>
</ul>
</section>