2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-05-24 07:24:05 +03:00
Files
vue-meta/examples/vuex-async/views/Post.vue
T
Sebastien Chopin cf5c55f068 Fix typo
2017-05-12 17:35:46 +02:00

37 lines
769 B
Vue

<template>
<div>
<template v-if="isLoading">
<h3>Loading...</h3>
</template>
<template v-else>
<h3>{{ post.title }}</h3>
<p>{{ post.content}}</p>
<router-link to="/">Go back home</router-link>
</template>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: 'post',
beforeMount () {
const { slug } = this.$route.params
this.$store.dispatch('getPost', { slug })
},
computed: mapGetters([
'isLoading',
'post'
]),
metaInfo () {
return {
title: this.isLoading ? 'Loading...' : this.post.title,
meta: [
{ vmid: 'description', name: 'description', content: this.post.title }
]
}
}
}
</script>