mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
36 lines
578 B
Vue
36 lines
578 B
Vue
|
|
<template>
|
|
<div>
|
|
<p>{{ post.title }}!</p>
|
|
<p><nuxt-link to="/">Back home</nuxt-link></p>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
|
|
export default {
|
|
data ({ req }) {
|
|
// We can return a Promise instead of calling the callback
|
|
return axios.get('https://jsonplaceholder.typicode.com/posts/1')
|
|
.then((res) => {
|
|
return { post: res.data }
|
|
})
|
|
},
|
|
head () {
|
|
return {
|
|
title: this.post.title
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
p {
|
|
font-size: 20px;
|
|
text-align: center;
|
|
padding: 100px;
|
|
padding-bottom: 0;
|
|
}
|
|
</style>
|