Skip to content

Instantly share code, notes, and snippets.

@mercs600
Last active March 28, 2020 17:00
Show Gist options
  • Save mercs600/0f9f45d281b9860172930f053f637ffd to your computer and use it in GitHub Desktop.
Save mercs600/0f9f45d281b9860172930f053f637ffd to your computer and use it in GitHub Desktop.
nuxt-ssr-exercise-3_id.vue
<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