vuepress-theme-reco/layouts/Layout.vue
2020-03-15 19:37:40 +08:00

44 lines
1.1 KiB
Vue

<template>
<div>
<Common>
<component v-if="$frontmatter.home" :is="homeCom"/>
<Page v-else :sidebar-items="sidebarItems"/>
<Footer v-if="$frontmatter.home" class="footer" />
</Common>
</div>
</template>
<script>
import Home from '@theme/components/Home'
import HomeBlog from '@theme/components/HomeBlog'
import Page from '@theme/components/Page'
import Footer from '@theme/components/Footer'
import Common from '@theme/components/Common'
import { resolveSidebarItems } from '@theme/helpers/utils'
export default {
components: { HomeBlog, Home, Page, Common, Footer },
computed: {
sidebarItems () {
return resolveSidebarItems(
this.$page,
this.$page.regularPath,
this.$site,
this.$localePath
)
},
homeCom () {
const { type } = this.$themeConfig
if (type !== undefined) {
return type == 'blog' ? 'HomeBlog' : type
}
return 'Home'
}
}
}
</script>
<style src="prismjs/themes/prism-tomorrow.css"></style>
<style src="../styles/theme.styl" lang="stylus"></style>