2017-07-10 11:52:10 +00:00
|
|
|
<template>
|
|
|
|
<div class="post">
|
2018-11-24 18:49:19 +00:00
|
|
|
<Component :is="component" />
|
2017-07-10 11:52:10 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
// See https://vuejs.org/v2/guide/components.html#Advanced-Async-Components
|
2018-08-06 00:12:44 +00:00
|
|
|
const getPost = slug => ({
|
2017-07-10 11:52:10 +00:00
|
|
|
component: import(`@/posts/${slug}`),
|
|
|
|
error: require('@/posts/404')
|
|
|
|
})
|
|
|
|
|
|
|
|
export default {
|
2017-10-31 13:43:55 +00:00
|
|
|
beforeCreate() {
|
2017-07-10 11:52:10 +00:00
|
|
|
this.component = () => getPost(this.$route.params.slug)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style src="@/assets/css/post.css"/>
|