Layouts in Vue CLI (not Nuxt)
This can easily be done with Slots and Component :is
.
<template lang="pug">
#App
component(v-if="layout" :is="layout")
router-view
router-view(v-else)
</template>
<script lang="ts">
import { Vue, Component, Watch } from 'vue-property-decorator'
@Component
export default class App extends Vue {
get layout () {
const layout = this.$route.meta.layout
return layout ? `${layout}-layout` : null
}
}
</script>
And it fallbacks to Blank Layout.