feat: v1.12.0

This commit is contained in:
xugaoyi 2022-06-01 11:42:01 +08:00
parent 9f5a20eb28
commit b069788b16
19 changed files with 170 additions and 69 deletions

View File

@ -130,12 +130,15 @@ export default defineConfig4CustomTheme<VdoingThemeConfig>({
// archive: false, // 是否打开归档功能默认true // archive: false, // 是否打开归档功能默认true
// categoryText: '随笔', // 碎片化文章_posts文件夹的文章预设生成的分类值默认'随笔' // categoryText: '随笔', // 碎片化文章_posts文件夹的文章预设生成的分类值默认'随笔'
// pageStyle: 'line', // 页面风格,可选值:'card'卡片 | 'line' 线未设置bodyBgImg时才生效 默认'card'。 说明card时背景显示灰色衬托出卡片样式line时背景显示纯色并且部分模块带线条边框
// bodyBgImg: [ // bodyBgImg: [
// 'https://cdn.jsdelivr.net/gh/xugaoyi/image_store/blog/20200507175828.jpeg', // 'https://cdn.jsdelivr.net/gh/xugaoyi/image_store/blog/20200507175828.jpeg',
// 'https://cdn.jsdelivr.net/gh/xugaoyi/image_store/blog/20200507175845.jpeg', // 'https://cdn.jsdelivr.net/gh/xugaoyi/image_store/blog/20200507175845.jpeg',
// 'https://cdn.jsdelivr.net/gh/xugaoyi/image_store/blog/20200507175846.jpeg' // 'https://cdn.jsdelivr.net/gh/xugaoyi/image_store/blog/20200507175846.jpeg'
// ], // body背景大图默认无。 单张图片 String | 多张图片 Array, 多张图片时每隔15秒换一张。 // ], // body背景大图默认无。 单张图片 String | 多张图片 Array, 多张图片时隔bodyBgImgInterval切换一张。
// bodyBgImgOpacity: 0.5, // body背景图透明度选值 0.1~ 1.0, 默认0.5 // bodyBgImgOpacity: 0.5, // body背景图透明度选值 0.1~1.0, 默认0.5
// bodyBgImgInterval: 15, // body多张背景图时的切换间隔, 默认15单位s
// titleBadge: false, // 文章标题前的图标是否显示默认true // titleBadge: false, // 文章标题前的图标是否显示默认true
// titleBadgeIcons: [ // 文章标题前图标的地址,默认主题内置图标 // titleBadgeIcons: [ // 文章标题前图标的地址,默认主题内置图标
// '图标地址1', // '图标地址1',

View File

@ -24,7 +24,7 @@
"vuepress-plugin-one-click-copy": "^1.0.2", "vuepress-plugin-one-click-copy": "^1.0.2",
"vuepress-plugin-thirdparty-search": "^1.0.2", "vuepress-plugin-thirdparty-search": "^1.0.2",
"vuepress-plugin-zooming": "^1.1.7", "vuepress-plugin-zooming": "^1.1.7",
"vuepress-theme-vdoing": "^1.11.3", "vuepress-theme-vdoing": "^1.12.0",
"yamljs": "^0.3.0" "yamljs": "^0.3.0"
} }
} }

View File

@ -123,6 +123,11 @@ export default {
<style lang='stylus'> <style lang='stylus'>
@require '../styles/wrapper.styl' @require '../styles/wrapper.styl'
.theme-style-line
.archives-page .theme-vdoing-wrapper
box-shadow 0 0
// border 1px solid var(--borderColor)
// border-radius 5px
.archives-page .archives-page
.theme-vdoing-wrapper .theme-vdoing-wrapper
@extend $vdoing-wrapper @extend $vdoing-wrapper

View File

@ -140,6 +140,10 @@ export default {
<style lang='stylus' scoped> <style lang='stylus' scoped>
@require '../styles/wrapper.styl' @require '../styles/wrapper.styl'
.theme-style-line
.articleInfo-wrap
.articleInfo
padding-top 0.5rem
.articleInfo-wrap .articleInfo-wrap
@extend $wrapper @extend $wrapper
position relative position relative

View File

@ -8,14 +8,14 @@
<script> <script>
import { type } from '../util' import { type } from '../util'
export default { export default {
data () { data() {
return { return {
bgImg: '', bgImg: '',
opacity: 0.5 opacity: 0.5
} }
}, },
mounted () { mounted() {
let { bodyBgImg, bodyBgImgOpacity,bodyBgImgInterval = 15 } = this.$themeConfig let { bodyBgImg, bodyBgImgOpacity, bodyBgImgInterval = 15 } = this.$themeConfig
if (type(bodyBgImg) === 'string') { if (type(bodyBgImg) === 'string') {
this.bgImg = bodyBgImg this.bgImg = bodyBgImg
@ -30,6 +30,12 @@ export default {
count = 0 count = 0
} }
this.bgImg = bodyBgImg[count] this.bgImg = bodyBgImg[count]
//
if (bodyBgImg[count + 1]) {
const img = new Image()
img.src = bodyBgImg[count + 1]
}
}, bodyBgImgInterval * 1000); }, bodyBgImgInterval * 1000);
} }

View File

@ -38,7 +38,7 @@ import Pagination from '@theme/components/Pagination'
import CategoriesBar from '@theme/components/CategoriesBar' import CategoriesBar from '@theme/components/CategoriesBar'
export default { export default {
data () { data() {
return { return {
category: '', category: '',
total: 0, // total: 0, //
@ -47,7 +47,7 @@ export default {
} }
}, },
components: { MainLayout, PostList, Pagination, CategoriesBar }, components: { MainLayout, PostList, Pagination, CategoriesBar },
mounted () { mounted() {
const queryCategory = this.$route.query.category const queryCategory = this.$route.query.category
if (queryCategory) { if (queryCategory) {
this.category = queryCategory this.category = queryCategory
@ -70,12 +70,12 @@ export default {
} }
}, },
methods: { methods: {
handlePagination (i) { // handlePagination(i) { //
this.currentPage = i this.currentPage = i
} }
}, },
watch: { watch: {
'$route.query.category' (category) { '$route.query.category'(category) {
this.category = category ? decodeURIComponent(category) : '' this.category = category ? decodeURIComponent(category) : ''
if (this.category) { if (this.category) {
this.total = this.$groupPosts.categories[this.category].length this.total = this.$groupPosts.categories[this.category].length
@ -128,4 +128,13 @@ export default {
display block display block
.categories .categories
max-height 12.3rem max-height 12.3rem
.theme-style-line
.categories-page
.main-left
.categories-wrapper
@media (max-width $MQMobile)
margin-top -0.91rem
margin-bottom -1px
padding 0.9rem 0.2rem
padding-bottom 0.5rem
</style> </style>

View File

@ -469,12 +469,13 @@ export default {
margin-top 2rem margin-top 2rem
.main-left .main-left
.card-box .card-box
margin-bottom 0.9rem margin-bottom 2rem
.pagination .pagination
margin-bottom 4rem margin-bottom 3rem
.theme-vdoing-content .theme-vdoing-content
padding 0 2rem padding 0 2rem
overflow hidden overflow hidden
border none
&>:first-child &>:first-child
padding-top 2rem padding-top 2rem
&>:last-child &>:last-child
@ -534,4 +535,8 @@ export default {
.feature .feature
h2 h2
font-size 1.25rem font-size 1.25rem
.theme-style-line
.main-wrapper
@media (max-width 719px)
margin-top -1px
</style> </style>

View File

@ -32,7 +32,7 @@
@media (max-width 900px) @media (max-width 900px)
width 235px width 235px
.card-box .card-box
margin 0 0 0.9rem 0.9rem margin 0 0 0.8rem 0.8rem
padding-top 0.95rem padding-top 0.95rem
padding-bottom 0.95rem padding-bottom 0.95rem
// 719px // 719px
@ -56,4 +56,9 @@
margin 0 0 0.9rem 0 margin 0 0 0.9rem 0
border-radius 0 border-radius 0
width 100% width 100%
.theme-style-line
.main-wrapper
.main-right
.card-box
margin -1px 0 0 0
</style> </style>

View File

@ -3,6 +3,7 @@
<main class="page"> <main class="page">
<div :class="`theme-vdoing-wrapper ${bgStyle}`"> <div :class="`theme-vdoing-wrapper ${bgStyle}`">
<ArticleInfo v-if="isArticle()" /> <ArticleInfo v-if="isArticle()" />
<div v-else class="placeholder" />
<component <component
class="theme-vdoing-content" class="theme-vdoing-content"
v-if="pageComponent" v-if="pageComponent"
@ -124,6 +125,16 @@ export default {
padding-top: ($navbarHeight + 1.5rem) padding-top: ($navbarHeight + 1.5rem)
>* >*
@extend $vdoing-wrapper @extend $vdoing-wrapper
.theme-style-line
.page
@media (min-width $MQMobile)
padding-top $navbarHeight
&>*
&:not(.footer)
box-shadow 0 0
.placeholder
@media (min-width 720px)
height 1.2rem
.theme-vdoing-wrapper .theme-vdoing-wrapper
.content-wrapper .content-wrapper
position relative position relative

View File

@ -2,36 +2,32 @@
<div class="pagination"> <div class="pagination">
<span <span
class="card-box prev iconfont icon-jiantou-zuo" class="card-box prev iconfont icon-jiantou-zuo"
:class="{disabled: currentPage === 1}" :class="{ disabled: currentPage === 1 }"
@click="goPrex()" @click="goPrex()"
> >
<p>上一页</p> <p>上一页</p>
</span> </span>
<!-- 分页在5页及以下时 --> <!-- 分页在5页及以下时 -->
<div <div class="pagination-list" v-if="pages <= 5">
class="pagination-list"
v-if="pages <= 5"
>
<span <span
class="card-box" class="card-box"
v-for="item in pages" v-for="item in pages"
:key="item" :key="item"
:class="{active: currentPage === item}" :class="{ active: currentPage === item }"
@click="goIndex(item)" @click="goIndex(item)"
>{{item}}</span> >{{ item }}</span
>
</div> </div>
<!-- 分页在5页以上 --> <!-- 分页在5页以上 -->
<div <div class="pagination-list" v-else>
class="pagination-list"
v-else
>
<!-- 一号位 --> <!-- 一号位 -->
<span <span
class="card-box" class="card-box"
:class="{active: currentPage === 1}" :class="{ active: currentPage === 1 }"
@click="goIndex(1)" @click="goIndex(1)"
>1</span> >1</span
>
<!-- 二号位 --> <!-- 二号位 -->
<span <span
@ -44,42 +40,46 @@
<span <span
class="card-box" class="card-box"
v-show="currentPage <= 3" v-show="currentPage <= 3"
:class="{active: currentPage === 2}" :class="{ active: currentPage === 2 }"
@click="goIndex(2)" @click="goIndex(2)"
>2</span> >2</span
>
<!-- 三号位 --> <!-- 三号位 -->
<span <span
class="card-box" class="card-box"
:class="{active: currentPage >= 3 && currentPage <= (pages - 2)}" :class="{ active: currentPage >= 3 && currentPage <= pages - 2 }"
@click="goIndex(threeNum())" @click="goIndex(threeNum())"
>{{ threeNum() }}</span> >{{ threeNum() }}</span
>
<!-- 四号位 --> <!-- 四号位 -->
<span <span
class="ellipsis ell-four" class="ellipsis ell-four"
v-show="currentPage < (pages - 2)" v-show="currentPage < pages - 2"
@click="goIndex(currentPage + 2)" @click="goIndex(currentPage + 2)"
title="下两页" title="下两页"
/> />
<span <span
class="card-box" class="card-box"
v-show="currentPage >= (pages - 2)" v-show="currentPage >= pages - 2"
:class="{active: currentPage === pages-1}" :class="{ active: currentPage === pages - 1 }"
@click="goIndex(pages-1)" @click="goIndex(pages - 1)"
>{{ pages-1 }}</span> >{{ pages - 1 }}</span
>
<!-- 五号位 --> <!-- 五号位 -->
<span <span
class="card-box" class="card-box"
:class="{active: currentPage === pages}" :class="{ active: currentPage === pages }"
@click="goIndex(pages)" @click="goIndex(pages)"
>{{pages}}</span> >{{ pages }}</span
>
</div> </div>
<span <span
class="card-box next iconfont icon-jiantou-you" class="card-box next iconfont icon-jiantou-you"
:class="{disabled: currentPage === pages}" :class="{ disabled: currentPage === pages }"
@click="goNext()" @click="goNext()"
> >
<p>下一页</p> <p>下一页</p>
@ -104,12 +104,12 @@ export default {
} }
}, },
computed: { computed: {
pages () { // pages() { //
return Math.ceil(this.total / this.perPage) return Math.ceil(this.total / this.perPage)
} }
}, },
methods: { methods: {
threeNum () { // threeNum() { //
let num = 3 let num = 3
const currentPage = this.currentPage const currentPage = this.currentPage
const pages = this.pages const pages = this.pages
@ -122,24 +122,24 @@ export default {
} }
return num return num
}, },
goPrex () { goPrex() {
let currentPage = this.currentPage let currentPage = this.currentPage
if (currentPage > 1) { if (currentPage > 1) {
this.handleEmit(--currentPage) this.handleEmit(--currentPage)
} }
}, },
goNext () { goNext() {
let currentPage = this.currentPage let currentPage = this.currentPage
if (currentPage < this.pages) { if (currentPage < this.pages) {
this.handleEmit(++currentPage) this.handleEmit(++currentPage)
} }
}, },
goIndex (i) { goIndex(i) {
if (i !== this.currentPage) { if (i !== this.currentPage) {
this.handleEmit(i) this.handleEmit(i)
} }
}, },
handleEmit (i) { handleEmit(i) {
this.$emit('getCurrentPage', i) this.$emit('getCurrentPage', i)
} }
} }
@ -151,6 +151,9 @@ export default {
position relative position relative
height 60px height 60px
text-align center text-align center
@media (max-width 720px)
margin-left 1px
margin-right 1px
span span
line-height 1rem line-height 1rem
opacity 0.9 opacity 0.9
@ -176,16 +179,20 @@ export default {
top 0 top 0
padding 1rem 1.2rem padding 1rem 1.2rem
font-size 0.95rem font-size 0.95rem
&::before
font-size 0.4rem
&.disabled &.disabled
color rgba(125, 125, 125, 0.5) color rgba(125, 125, 125, 0.5)
&.prev &.prev
left 0 left 0
border-top-right-radius 32px // border-top-right-radius 32px
border-bottom-right-radius 32px // border-bottom-right-radius 32px
&::before
margin-right 0.3rem
&.next &.next
right 0 right 0
border-top-left-radius 32px // border-top-left-radius 32px
border-bottom-left-radius 32px // border-bottom-left-radius 32px
&::before &::before
float right float right
margin-left 0.3rem margin-left 0.3rem

View File

@ -1,8 +1,8 @@
<template> <template>
<div class="post-list" ref="postList"> <div class="post-list card-box" ref="postList">
<transition-group tag="div" name="post"> <transition-group tag="div" name="post">
<div <div
class="post card-box" class="post"
:class="item.frontmatter.sticky && 'iconfont icon-zhiding'" :class="item.frontmatter.sticky && 'iconfont icon-zhiding'"
v-for="item in sortPosts" v-for="item in sortPosts"
:key="item.key" :key="item.key"
@ -169,8 +169,11 @@ export default {
.post .post
position relative position relative
padding 1rem 1.5rem padding 1rem 1.5rem
margin-bottom 0.9rem // margin-bottom 0.9rem
transition all 0.3s transition all 0.3s
border-bottom 1px solid var(--borderColor)
&:last-child
border-bottom none
&.post-leave-active &.post-leave-active
display none display none
&.post-enter &.post-enter
@ -243,4 +246,15 @@ export default {
float right float right
font-size 0.8rem font-size 0.8rem
margin 0.1rem 0 0 0.2rem margin 0.1rem 0 0 0.2rem
.theme-style-line
.post-list
border 1px solid var(--borderColor)
// border-bottom none
border-radius 5px
overflow hidden
.post
// margin-bottom 0
// border none
// border-bottom 1px solid var(--borderColor)
// border-radius 0
</style> </style>

View File

@ -49,6 +49,10 @@ export default {
</script> </script>
<style lang='stylus'> <style lang='stylus'>
.theme-style-line
.right-menu-wrapper
.right-menu-margin
border-left 1px solid var(--borderColor)
.right-menu-wrapper .right-menu-wrapper
width $rightMenuWidth width $rightMenuWidth
float right float right
@ -56,7 +60,7 @@ export default {
// margin-top -($navbarHeight *2 + 1.5rem) // margin-top -($navbarHeight *2 + 1.5rem)
position sticky position sticky
top 0 top 0
font-size 0.75rem font-size 0.8rem
.right-menu-margin .right-menu-margin
margin-top: ($navbarHeight + 1rem) margin-top: ($navbarHeight + 1rem)
border-radius 3px border-radius 3px

View File

@ -7,11 +7,7 @@
:tagsData="$categoriesAndTags.tags" :tagsData="$categoriesAndTags.tags"
:tag="tag" :tag="tag"
/> />
<PostList <PostList :currentPage="currentPage" :perPage="perPage" :tag="tag" />
:currentPage="currentPage"
:perPage="perPage"
:tag="tag"
/>
<Pagination <Pagination
:total="total" :total="total"
:perPage="perPage" :perPage="perPage"
@ -38,7 +34,7 @@ import Pagination from '@theme/components/Pagination'
import TagsBar from '@theme/components/TagsBar' import TagsBar from '@theme/components/TagsBar'
export default { export default {
data () { data() {
return { return {
tag: '', tag: '',
total: 0, // total: 0, //
@ -47,7 +43,7 @@ export default {
} }
}, },
components: { MainLayout, PostList, Pagination, TagsBar }, components: { MainLayout, PostList, Pagination, TagsBar },
mounted () { mounted() {
const queryTag = this.$route.query.tag const queryTag = this.$route.query.tag
if (queryTag) { if (queryTag) {
@ -61,12 +57,12 @@ export default {
} }
}, },
methods: { methods: {
handlePagination (i) { // handlePagination(i) { //
this.currentPage = i this.currentPage = i
} }
}, },
watch: { watch: {
'$route.query.tag' (tag) { '$route.query.tag'(tag) {
this.tag = tag ? decodeURIComponent(tag) : '' this.tag = tag ? decodeURIComponent(tag) : ''
if (this.tag) { if (this.tag) {
@ -85,7 +81,7 @@ export default {
.tags-page .tags-page
.tags-wrapper .tags-wrapper
position sticky position sticky
top ($navbarHeight + 0.9rem) top: ($navbarHeight + 0.9rem)
max-height calc(100vh - 10rem) max-height calc(100vh - 10rem)
min-height 4.2rem min-height 4.2rem
@media (max-width $MQMobile) @media (max-width $MQMobile)
@ -119,4 +115,11 @@ export default {
display block display block
.tags .tags
max-height 11.5rem max-height 11.5rem
.theme-style-line
.tags-page
.main-left
.tags-wrapper
@media (max-width $MQMobile)
margin-top -0.91rem
margin-bottom -1px
</style> </style>

View File

@ -262,7 +262,6 @@ export default {
setTimeout(() => { t = p }, 0) setTimeout(() => { t = p }, 0)
} }
}, 300)) }, 300))
}, },
watch: { watch: {
isSidebarOpen() { isSidebarOpen() {
@ -280,7 +279,9 @@ export default {
return htmlModules ? htmlModules[module] : '' return htmlModules ? htmlModules[module] : ''
}, },
setBodyClass() { setBodyClass() {
document.body.className = 'theme-mode-' + this.themeMode let { pageStyle = 'card', bodyBgImg } = this.$themeConfig
if (pageStyle !== 'card' && pageStyle !== 'line' || bodyBgImg) { pageStyle = 'card' }
document.body.className = `theme-mode-${this.themeMode} theme-style-${pageStyle}`
}, },
getScrollTop() { getScrollTop() {
return window.pageYOffset return window.pageYOffset

View File

@ -1,6 +1,6 @@
{ {
"name": "vuepress-theme-vdoing", "name": "vuepress-theme-vdoing",
"version": "1.11.3", "version": "1.12.0",
"description": "Vdoing theme for VuePress. 一个基于VuePress的知识管理兼博客主题。", "description": "Vdoing theme for VuePress. 一个基于VuePress的知识管理兼博客主题。",
"author": { "author": {
"name": "gaoyi(Evan) Xu" "name": "gaoyi(Evan) Xu"

View File

@ -47,11 +47,19 @@ a,input,button
.card-box // .card-box //
border-radius 5px border-radius 5px
background var(--mainBg) background var(--mainBg)
box-shadow 0 1px 2px 0 rgba(0,0,0,.1) box-shadow 0px 0px 4px 0 rgba(0,0,0,.1)
transition box-shadow .5s transition box-shadow .5s
&:hover &:hover
box-shadow 0 1px 15px 0 rgba(0,0,0,.1) box-shadow 0 1px 15px 0 rgba(0,0,0,.1)
.theme-style-line
@media (max-width: 719px)
margin-left: -1px;
margin-right: -1px;
.card-box
box-shadow 0 0
border: 1px solid var(--borderColor)
.blur // .blur //
backdrop-filter saturate(200%) blur(20px) backdrop-filter saturate(200%) blur(20px)
@ -210,7 +218,7 @@ p,pre,.custom-block
h1 h1
font-size 1.8rem font-size 1.9rem
{$contentClass}:not(.custom) > & // h1 {$contentClass}:not(.custom) > & // h1
&:first-child &:first-child
display none display none

View File

@ -53,7 +53,7 @@ $lineNumbersWrapperWidth = 2.5rem
--customBlockBg: #f1f1f1 --customBlockBg: #f1f1f1
--textColor: #00323c --textColor: #00323c
--textLightenColor: #0085AD --textLightenColor: #0085AD
--borderColor: rgba(0,0,0,.15) --borderColor: rgba(0,0,0,.12)
--codeBg: #f6f6f6 --codeBg: #f6f6f6
--codeColor: #525252 --codeColor: #525252
codeThemeLight() codeThemeLight()
@ -67,7 +67,8 @@ $lineNumbersWrapperWidth = 2.5rem
--customBlockBg: rgb(39,39,43) --customBlockBg: rgb(39,39,43)
--textColor: rgb(155,155,170) --textColor: rgb(155,155,170)
--textLightenColor: #0085AD --textLightenColor: #0085AD
--borderColor: #2C2C3A // --borderColor: #2C2C3A
--borderColor: #30363d
--codeBg: #252526 --codeBg: #252526
--codeColor: #fff --codeColor: #fff
codeThemeDark() codeThemeDark()
@ -85,3 +86,11 @@ $lineNumbersWrapperWidth = 2.5rem
--codeBg: #282c34 --codeBg: #282c34
--codeColor: #fff --codeColor: #fff
codeThemeDark() codeThemeDark()
//
.theme-style-line.theme-mode-light
--bodyBg: rgba(255,255,255,1)
.theme-style-line.theme-mode-dark
--bodyBg: rgba(30,30,34,1)
.theme-style-line.theme-mode-read
--bodyBg: rgba(245,245,213,1)

View File

@ -5,6 +5,7 @@ $vdoing-wrapper
&:not(.footer) &:not(.footer)
background var(--mainBg) background var(--mainBg)
box-shadow 0 1px 2px 0 rgba(0,0,0,.1) box-shadow 0 1px 2px 0 rgba(0,0,0,.1)
// box-shadow 0 0 3px 0 rgba(0,0,0,.1)
margin-bottom 1rem margin-bottom 1rem
@media (min-width $contentWidth + 80) @media (min-width $contentWidth + 80)
border-radius 2px border-radius 2px

View File

@ -31,6 +31,12 @@ export interface VdoingThemeConfig extends NoSidebar4DefaultThemeConfig {
*/ */
categoryText?: string; categoryText?: string;
/**
*
* @default 'card'
*/
pageStyle?: 'card' | 'line';
/** /**
* body背景大图链接 string | string[], 15 * body背景大图链接 string | string[], 15
* @default '' * @default ''