feat: 首页配置中添加隐藏右侧边栏配置项
This commit is contained in:
parent
8f3df4a892
commit
523133d316
|
|
@ -24,6 +24,7 @@ features: # 可选的
|
|||
# 文章列表显示方式: detailed 默认,显示详细版文章列表(包括作者、分类、标签、摘要、分页等)| simple => 显示简约版文章列表(仅标题和日期)| none 不显示文章列表
|
||||
# postList: detailed
|
||||
# simplePostListLength: 10 # 简约版文章列表显示的文章数量,默认10。(仅在postList设置为simple时生效)
|
||||
# hideRightBar: true # 是否隐藏右侧边栏
|
||||
---
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@
|
|||
<Content class="theme-vdoing-content custom card-box" />
|
||||
</template>
|
||||
|
||||
<template #mainRight>
|
||||
<template v-if="!homeData.hideRightBar" #mainRight>
|
||||
<BloggerBar v-if="$themeConfig.blogger" />
|
||||
<CategoriesBar
|
||||
v-if="
|
||||
|
|
@ -177,7 +177,7 @@ const MOBILE_DESKTOP_BREAKPOINT = 720 // refer to config.styl
|
|||
BScroll.use(Slide)
|
||||
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
isMQMobile: false,
|
||||
|
||||
|
|
@ -192,25 +192,25 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
homeData () {
|
||||
homeData() {
|
||||
return {
|
||||
...this.$page.frontmatter
|
||||
}
|
||||
},
|
||||
hasFeatures () {
|
||||
hasFeatures() {
|
||||
return !!(this.homeData.features && this.homeData.features.length)
|
||||
},
|
||||
homeSidebarB () {
|
||||
homeSidebarB() {
|
||||
const { htmlModules } = this.$themeConfig
|
||||
return htmlModules ? htmlModules.homeSidebarB : ''
|
||||
},
|
||||
showBanner () { // 当分页不在第一页时隐藏banner栏
|
||||
showBanner() { // 当分页不在第一页时隐藏banner栏
|
||||
return this.$route.query.p
|
||||
&& this.$route.query.p != 1
|
||||
&& (!this.homeData.postList || this.homeData.postList === 'detailed')
|
||||
? false : true
|
||||
},
|
||||
bannerBgStyle () {
|
||||
bannerBgStyle() {
|
||||
let bannerBg = this.homeData.bannerBg
|
||||
if (!bannerBg || bannerBg === 'auto') { // 默认
|
||||
if (this.$themeConfig.bodyBgImg) { // 当有bodyBgImg时,不显示背景
|
||||
|
|
@ -231,7 +231,7 @@ export default {
|
|||
}
|
||||
|
||||
},
|
||||
actionLink () {
|
||||
actionLink() {
|
||||
return {
|
||||
link: this.homeData.actionLink,
|
||||
text: this.homeData.actionText
|
||||
|
|
@ -239,13 +239,13 @@ export default {
|
|||
}
|
||||
},
|
||||
components: { NavLink, MainLayout, PostList, UpdateArticle, BloggerBar, CategoriesBar, TagsBar, Pagination },
|
||||
created () {
|
||||
created() {
|
||||
this.total = this.$sortPosts.length
|
||||
},
|
||||
beforeMount () {
|
||||
beforeMount() {
|
||||
this.isMQMobile = window.innerWidth < MOBILE_DESKTOP_BREAKPOINT ? true : false; // vupress在打包时不能在beforeCreate(),created()访问浏览器api(如window)
|
||||
},
|
||||
mounted () {
|
||||
mounted() {
|
||||
if (this.$route.query.p) {
|
||||
this.currentPage = Number(this.$route.query.p)
|
||||
}
|
||||
|
|
@ -266,12 +266,12 @@ export default {
|
|||
})
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.playTimer)
|
||||
this.slide && this.slide.destroy()
|
||||
},
|
||||
watch: {
|
||||
'$route.query.p' () {
|
||||
'$route.query.p'() {
|
||||
if (!this.$route.query.p) {
|
||||
this.currentPage = 1
|
||||
} else {
|
||||
|
|
@ -287,7 +287,7 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
init() {
|
||||
clearTimeout(this.playTimer)
|
||||
this.slide = new BScroll(this.$refs.slide, {
|
||||
scrollX: true, // x轴滚动
|
||||
|
|
@ -317,16 +317,16 @@ export default {
|
|||
})
|
||||
this.autoGoNext()
|
||||
},
|
||||
autoGoNext () {
|
||||
autoGoNext() {
|
||||
clearTimeout(this.playTimer)
|
||||
this.playTimer = setTimeout(() => {
|
||||
this.slide.next()
|
||||
}, 4000)
|
||||
},
|
||||
handlePagination (i) { // 分页
|
||||
handlePagination(i) { // 分页
|
||||
this.currentPage = i
|
||||
},
|
||||
getScrollTop () {
|
||||
getScrollTop() {
|
||||
return window.pageYOffset
|
||||
|| document.documentElement.scrollTop
|
||||
|| document.body.scrollTop
|
||||
|
|
|
|||
Loading…
Reference in New Issue