Last active
March 28, 2020 17:00
-
-
Save mercs600/0f9f45d281b9860172930f053f637ffd to your computer and use it in GitHub Desktop.
nuxt-ssr-exercise-3_id.vue
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
<template> | |
<div> | |
<h1> {{ post.title }} </h1> | |
<div> {{ post.body }} </div> | |
<nuxt-link to="/asyncData-blog">back to list</nuxt-link> | |
</div> | |
</template> | |
<script> | |
export default { | |
asyncData: ({ $http, params }) => $http | |
.$get(`https://jsonplaceholder.typicode.com/posts/${params.id}`) | |
.then(post => ({ post })) | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment