mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-04 11:27:13 +00:00
16 lines
333 B
Vue
16 lines
333 B
Vue
|
<template>
|
||
|
<BlogArticle/>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
|
async asyncData({ params, error }) {
|
||
|
const slug = params.slug || 'hello'
|
||
|
try {
|
||
|
this.components.BlogArticle = await import(`~/articles/${slug}.vue`)
|
||
|
} catch (e) {
|
||
|
error({ statusCode: 404, message: 'Article not found' })
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|