Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | <template>
<div class="container">
<div class="row">
<h1>Trending this week</h1>
</div>
<Loader />
<div class="row mt-4">
<div class="col-3">
<div class="card shadow">
<div class="list-group">
<router-link
to="/?mediatype=movie"
tag="button"
class="list-group-item list-group-item-action"
>Movies</router-link
>
<router-link
to="/?mediatype=tv"
tag="button"
class="list-group-item list-group-item-action"
>Tv</router-link
>
</div>
</div>
</div>
<div class="col-9">
<div class="row">
<div class="card-columns">
<MovieCard
v-for="movie in getTrending"
:key="movie.id"
:movie="movie"
>
<div class="card-footer bg-white text-center">
<div class="row">
<div class="col-6">
<AddToFavouritesButton :movie="movie" />
</div>
<div class="col-6">
<router-link
:to="`/${movie.media_type}/${movie.id}`"
tag="button"
class="btn btn-primary"
>View details</router-link
>
</div>
</div>
</div>
</MovieCard>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import MovieCard from '@/components/MovieCard.vue'
import AddToFavouritesButton from '@/components/AddToFavouritesButton.vue'
import Loader from '@/components/Loader.vue'
import { mapGetters } from 'vuex'
export default {
name: 'Home',
components: {
MovieCard,
Loader,
AddToFavouritesButton
},
computed: {
...mapGetters({
getTrending: 'allTrending'
}),
mediaType() {
return this.$route.query.mediatype || 'movie'
}
},
mounted() {
this.$store.dispatch('fetchMovies', { type: this.mediaType })
}
}
</script>
<style scoped></style>
|