mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +00:00
19 lines
456 B
Vue
19 lines
456 B
Vue
<template>
|
|
<component :is="comp"/>
|
|
</template>
|
|
|
|
<script>
|
|
const components = {}
|
|
const files = require.context('@/articles', false, /\.vue$/)
|
|
files.keys().forEach((filename) => {
|
|
const name = filename.replace('./', '').replace('.vue', '')
|
|
components[name] = () => import('@/articles/' + name + '.vue').then((m) => m.default || m)
|
|
})
|
|
|
|
export default {
|
|
async asyncData({ params, error }) {
|
|
return { comp: params.slug }
|
|
},
|
|
components
|
|
}
|
|
</script> |