Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created June 10, 2019 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uno-de-piera/fc6996a96e94333ec417b72dc0f2cd14 to your computer and use it in GitHub Desktop.
Save uno-de-piera/fc6996a96e94333ec417b72dc0f2cd14 to your computer and use it in GitHub Desktop.
<template>
<div v-if="posts.length > 0">
<post v-for="post in posts" :key="post.id" :post="post" />
</div>
</div>
<script>
import Post from '@/components/Post'
export default {
name: 'Posts',
components: {
Post
},
data () {
return {
posts: []
}
},
async mounted () {
const {data} = this.$store.dispatch('fetchPosts')
this.posts = data.posts;
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment