Nuxt/examples/async-data/pages/post.vue

30 lines
459 B
Vue
Raw Normal View History

<template>
<div>
<p>{{ post.title }}!</p>
<p><router-link to="/">Back home</router-link></p>
</div>
</template>
<script>
const axios = require('axios')
export default {
2016-11-07 13:12:59 +00:00
data ({ req }) {
return axios.get('https://jsonplaceholder.typicode.com/posts/1')
.then((res) => {
return { post: res.data }
2016-11-07 13:12:59 +00:00
})
}
}
</script>
2016-11-07 13:12:59 +00:00
<style scoped>
p {
font-size: 20px;
text-align: center;
padding: 100px;
2016-11-07 13:12:59 +00:00
padding-bottom: 0;
}
</style>