vuepress-theme-reco/layouts/Layout.vue
reco_luan 8994c5bb59 feat: Add component & optimization
1. Project optimization
2. Add module loading animation component
2019-12-05 14:59:03 +08:00

53 lines
1.3 KiB
Vue

<template>
<div>
<Common>
<component v-if="$frontmatter.home" :is="homeCom"></component>
<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" />
</Common>
</div>
</template>
<script>
import Home from '@theme/components/Home.vue'
import HomeBlog from '@theme/components/HomeBlog.vue'
import Page from '@theme/components/Page.vue'
import Footer from '@theme/components/Footer.vue'
import Common from '@theme/components/Common.vue'
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>