Skip to content

Instantly share code, notes, and snippets.

@burkeholland
Last active July 5, 2019 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save burkeholland/df47fe3c9860e057dce50d012cffa5c3 to your computer and use it in GitHub Desktop.
Save burkeholland/df47fe3c9860e057dce50d012cffa5c3 to your computer and use it in GitHub Desktop.
<template>
<div class="section">
<h1 class="is-size-1">Photos</h1>
<div class="columns is-multiline">
<div
v-for="photo in photos"
:key="photo.id"
class="column is-one-quarter"
>
<div class="card photo">
<div class="card-image">
<figure class="image">
<img :src="photo.url" alt="photo.title" />
</figure>
</div>
<div class="card-content">
<div class="content">
<p>{{ photo.title }}</p>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
async asyncData({ $axios }) {
const { data } = await $axios.get(
'https://jsonplaceholder.typicode.com/photos?_limit=100'
)
return { photos: data }
}
}
</script>
<style>
.card.photo {
height: 100%;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment