-
-
Save uno-de-piera/fc6996a96e94333ec417b72dc0f2cd14 to your computer and use it in GitHub Desktop.
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 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