Skip to content

Instantly share code, notes, and snippets.

@ramsaylanier
Created February 8, 2018 15:03
Show Gist options
  • Select an option

  • Save ramsaylanier/f5023f11966f7d059e6f43b0e090e270 to your computer and use it in GitHub Desktop.

Select an option

Save ramsaylanier/f5023f11966f7d059e6f43b0e090e270 to your computer and use it in GitHub Desktop.
<template>
<div class="page">
<div class="header">
<div class="wrapper">
<h1 class="title">{{game.title}}</h1>
</div>
</div>
<div class="body">
<div class="wrapper">
<router-view name="page"/>
</div>
</div>
<modal v-if="showModal" ref="modal">
<router-view name="rule"/>
</modal>
</div>
</template>
<script>
import games from '@/data/games'
import Modal from '@/components/Modal'
export default {
name: 'Game',
components: {
Modal
},
data () {
return {
game: games.filter(game => game.id === parseInt(this.$route.params.id))[0],
showModal: this.$route.meta.showModal
}
},
watch: {
'$route.meta' ({showModal}) {
this.showModal = showModal
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment