Skip to content

Instantly share code, notes, and snippets.

@Mattchewone
Created June 15, 2018 09:45
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 Mattchewone/07c512a86fba3ff7b1b0529e533fb655 to your computer and use it in GitHub Desktop.
Save Mattchewone/07c512a86fba3ff7b1b0529e533fb655 to your computer and use it in GitHub Desktop.
<template>
<div class="movies">
<ul>
<li v-for="movie in movies" :key="movie._id">
{{ movie.title }}
</li>
</ul>
</div>
</template>
<script>
import { mapActions, mapGetters } from 'vuex'
export default {
name: 'movies',
computed: {
...mapGetters('movies', {
findMoviesInStore: 'find'
}),
movies () {
return this.findMoviesInStore({ query: {} }).data
}
},
methods: {
...mapActions('movies', {
findMovies: 'find'
})
},
created () {
this.findMovies({ query: {} })
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment