2017-07-10 11:52:10 +00:00
|
|
|
<template>
|
|
|
|
<div class="post">
|
2018-08-31 20:34:12 +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"/>
|