vuepress-theme-reco/layouts/Layout.vue

53 lines
1.2 KiB
Vue
Raw Normal View History

2019-04-15 10:35:40 +08:00
<template>
<div>
<Common>
<component v-if="$frontmatter.home" :is="homeCom"></component>
2019-04-15 10:35:40 +08:00
<Page
v-else
:sidebar-items="sidebarItems">
<slot
name="page-top"
slot="top"/>
<slot
name="page-bottom"
slot="bottom"/>
</Page>
<Footer v-if="$frontmatter.home" class="footer" />
2019-04-15 10:35:40 +08:00
</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'
2019-04-15 10:35:40 +08:00
export default {
components: { HomeBlog, Home, Page, Common, Footer },
2019-04-15 10:35:40 +08:00
computed: {
sidebarItems () {
return resolveSidebarItems(
this.$page,
this.$page.regularPath,
this.$site,
this.$localePath
)
2019-10-20 12:59:04 +08:00
},
homeCom () {
const { type } = this.$themeConfig
if (type !== undefined) {
return type == 'blog' ? 'HomeBlog' : type
2019-10-20 12:59:04 +08:00
}
return 'Home'
2019-04-15 10:35:40 +08:00
}
}
}
</script>
<style src="prismjs/themes/prism-tomorrow.css"></style>
<style src="../styles/theme.styl" lang="stylus"></style>