Created
May 18, 2018 18:26
-
-
Save chihirokaasan/aea6bcf6efd7ceda2b6b965b3f7fe96d to your computer and use it in GitHub Desktop.
doorkeeper apiからイベントを取得して表示
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*pagesディレクトリに設置 | |
<template> | |
<v-card class="mt-4 mb-4 pa-3"> | |
<v-layout row wrap> | |
<v-flex xs4 v-for="(item,i) in data" :key="i"> | |
<v-card class="blue ma-2"> | |
<v-card-text><img :src="item.event.banner" width="100%"></v-card-text> | |
<v-card-text>{{item.event.title}}</v-card-text> | |
</v-card> | |
</v-flex> | |
</v-layout> | |
</v-card> | |
</template> | |
<script> | |
import axios from 'axios' | |
export default { | |
layout: 'event', | |
asyncData ({params}, callback) { | |
axios.get('https://api.doorkeeper.jp/events/') | |
.then((res) => { | |
var data = res.data; | |
console.log(data); | |
callback(null, {data: res.data}) | |
}) | |
.catch((e) => { | |
callback({ statusCode: 404, message: 'ページが見つかりません' }) | |
}) | |
} | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
layoutsディレクトリに設置 | |
<template> | |
<v-app> | |
<v-toolbar> | |
<v-toolbar-title>Vuetifyテスト</v-toolbar-title> | |
</v-toolbar> | |
<nuxt /> | |
<v-footer :fixed="fixed" app> | |
<span>© ITkaasan</span> | |
</v-footer> | |
</v-app> | |
</template> | |
<script> | |
export default { | |
data() { | |
return { | |
title: 'Vuetify.js' | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment