v1.8.2
This commit is contained in:
parent
46ce942e19
commit
3fb8ea12cb
|
|
@ -3,7 +3,7 @@ const plugins = require('./config/plugins.js');
|
|||
const themeConfig = require('./config/themeConfig.js');
|
||||
|
||||
module.exports = {
|
||||
theme: 'vdoing', // 使用依赖包主题
|
||||
theme: 'vdoing', // 使用npm包主题
|
||||
// theme: require.resolve('../../theme-vdoing'), // 使用本地主题
|
||||
|
||||
title: "Evan's blog",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
pageComponent:
|
||||
pageComponent:
|
||||
name: Catalogue
|
||||
data:
|
||||
key: 《JavaScript教程》笔记
|
||||
data:
|
||||
path: 《JavaScript教程》笔记
|
||||
imgUrl: https://cdn.jsdelivr.net/gh/xugaoyi/image_store/blog/20200112120340.png
|
||||
description: 本章内容为博主在原教程基础上添加学习笔记,教程版权归原作者所有。来源:<a href='https://wangdoc.com/javascript/' target='_blank'>JavaScript教程</a>
|
||||
title: 《JavaScript教程》笔记
|
||||
|
|
@ -11,7 +11,7 @@ permalink: /note/javascript
|
|||
article: false
|
||||
comment: false
|
||||
editLink: false
|
||||
author:
|
||||
author:
|
||||
name: xugaoyi
|
||||
link: https://github.com/xugaoyi
|
||||
---
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
pageComponent:
|
||||
name: Catalogue
|
||||
data:
|
||||
key: 《ES6 教程》笔记
|
||||
path: 《ES6 教程》笔记
|
||||
imgUrl: https://cdn.jsdelivr.net/gh/xugaoyi/image_store/blog/20200112160453.png
|
||||
description: 本章内容为博主在原教程基础上添加学习笔记,教程版权归原作者所有。来源:<a href='https://es6.ruanyifeng.com/' target='_blank'>ES6教程</a>
|
||||
title: 《ES6 教程》笔记
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
pageComponent:
|
||||
name: Catalogue
|
||||
data:
|
||||
key: 《Vue》笔记
|
||||
path: 《Vue》笔记
|
||||
imgUrl: https://cdn.jsdelivr.net/gh/xugaoyi/image_store/blog/20200204143633.png
|
||||
description: 本章内容是博主的Vue学习笔记,非教程文档,请以官方文档为准。
|
||||
title: 《Vue》笔记
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
pageComponent:
|
||||
name: Catalogue
|
||||
data:
|
||||
key: 《React》笔记
|
||||
path: 《React》笔记
|
||||
imgUrl: data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ii0xMS41IC0xMC4yMzE3NCAyMyAyMC40NjM0OCI+CiAgPHRpdGxlPlJlYWN0IExvZ288L3RpdGxlPgogIDxjaXJjbGUgY3g9IjAiIGN5PSIwIiByPSIyLjA1IiBmaWxsPSIjNjFkYWZiIi8+CiAgPGcgc3Ryb2tlPSIjNjFkYWZiIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiPgogICAgPGVsbGlwc2Ugcng9IjExIiByeT0iNC4yIi8+CiAgICA8ZWxsaXBzZSByeD0iMTEiIHJ5PSI0LjIiIHRyYW5zZm9ybT0icm90YXRlKDYwKSIvPgogICAgPGVsbGlwc2Ugcng9IjExIiByeT0iNC4yIiB0cmFuc2Zvcm09InJvdGF0ZSgxMjApIi8+CiAgPC9nPgo8L3N2Zz4K
|
||||
description: 本章内容是博主的React学习笔记,非教程文档,请以官方文档为准。
|
||||
title: 《React》笔记
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
pageComponent:
|
||||
pageComponent:
|
||||
name: Catalogue
|
||||
data:
|
||||
key: 《TypeScript 从零实现 axios》
|
||||
data:
|
||||
path: 《TypeScript 从零实现 axios》
|
||||
imgUrl: https://cdn.jsdelivr.net/gh/xugaoyi/image_store/blog/20200105104632.png
|
||||
description: 学习使用 TypeScript 从零实现 axios 库
|
||||
title: 《TypeScript 从零实现 axios》
|
||||
|
|
@ -11,7 +11,7 @@ permalink: /note/typescript-axios
|
|||
article: false
|
||||
comment: false
|
||||
editLink: false
|
||||
author:
|
||||
author:
|
||||
name: xugaoyi
|
||||
link: https://github.com/xugaoyi
|
||||
---
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
pageComponent:
|
||||
name: Catalogue
|
||||
data:
|
||||
key: 《Git》学习笔记
|
||||
path: 《Git》学习笔记
|
||||
imgUrl: https://avatars3.githubusercontent.com/u/18133?s=200&v=4
|
||||
description: <a href='https://git-scm.com/book/zh/v2' target='_blank'>Git官网文档</a>的学习笔记,以官方文档为准。
|
||||
title: 《Git》学习笔记
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ title: 你知道的越多,不知道的也就越多
|
|||
date: 2020-05-06 15:52:40
|
||||
permalink: /pages/f2e63f
|
||||
sidebar: auto
|
||||
categories:
|
||||
categories:
|
||||
- 随笔
|
||||
tags:
|
||||
tags:
|
||||
- 学习
|
||||
- 知识
|
||||
- 鸡汤
|
||||
author:
|
||||
author:
|
||||
name: xugaoyi
|
||||
link: https://github.com/xugaoyi
|
||||
---
|
||||
|
|
@ -30,5 +30,3 @@ author:
|
|||
::: tip 鸡汤2
|
||||
当代青年人都应该摆脱冷气,只管向上走,不必听从自暴自弃者的流言。能做事的做事,能发声的发声。有一份热,发一份光,就像萤火一般,也可以在黑暗里发一点光,不必等候炬火。
|
||||
:::
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
"deploy": "bash deploy.sh",
|
||||
"editFm": "node utils/editFrontmatter.js",
|
||||
"baiduPush": "node utils/baiduPush.js https://xugaoyi.com && bash baiduPush.sh",
|
||||
"publish": "cd theme-vdoing && npm publish && cd ../ && npm run updateTheme",
|
||||
"publish": "cd ./theme-vdoing && npm publish && cd ../ && npm run updateTheme",
|
||||
"updateTheme": "npm uninstall vuepress-theme-vdoing && rm -rf node_modules && npm i && npm i vuepress-theme-vdoing -D"
|
||||
},
|
||||
"license": "MIT",
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
"vuepress-plugin-one-click-copy": "^1.0.2",
|
||||
"vuepress-plugin-thirdparty-search": "^1.0.2",
|
||||
"vuepress-plugin-zooming": "^1.1.7",
|
||||
"vuepress-theme-vdoing": "^1.8.1",
|
||||
"vuepress-theme-vdoing": "^1.8.2",
|
||||
"yamljs": "^0.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
|||
|
|
@ -6,21 +6,21 @@
|
|||
:src="currentBadge"
|
||||
v-if="$themeConfig.titleBadge === false ? false : true"
|
||||
/>
|
||||
{{this.$page.title}}
|
||||
{{ this.$page.title }}
|
||||
</h1>
|
||||
<ul>
|
||||
<template v-for="(item, index) in postsList">
|
||||
<li
|
||||
class="year"
|
||||
v-if="(year = getYear(index)) !== getYear(index-1)"
|
||||
:key="index+$sortPostsByDate.length"
|
||||
v-if="(year = getYear(index)) !== getYear(index - 1)"
|
||||
:key="index + $sortPostsByDate.length"
|
||||
>
|
||||
<h2>{{year}}</h2>
|
||||
<h2>{{ year }}</h2>
|
||||
</li>
|
||||
<li :key="index">
|
||||
<router-link :to="item.path">
|
||||
<span>{{ getDate(item) }}</span>
|
||||
{{item.title}}
|
||||
{{ item.title }}
|
||||
</router-link>
|
||||
</li>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -6,50 +6,58 @@
|
|||
v-if="articleInfo.classify1 && articleInfo.classify1 !== '_posts'"
|
||||
>
|
||||
<li>
|
||||
<router-link
|
||||
to="/"
|
||||
class="iconfont icon-home"
|
||||
title="首页"
|
||||
/>
|
||||
<router-link to="/" class="iconfont icon-home" title="首页" />
|
||||
</li>
|
||||
<li>
|
||||
<router-link
|
||||
v-if="articleInfo.cataloguePermalink"
|
||||
:to="articleInfo.cataloguePermalink"
|
||||
:title="articleInfo.classify1+'-目录页'"
|
||||
>{{articleInfo.classify1}}</router-link>
|
||||
:title="articleInfo.classify1 + '-目录页'"
|
||||
>{{ articleInfo.classify1 }}</router-link
|
||||
>
|
||||
<router-link
|
||||
v-else-if="$themeConfig.category !== false"
|
||||
:to="`/categories/?category=${encodeURIComponent(articleInfo.classify1)}`"
|
||||
:to="`/categories/?category=${encodeURIComponent(
|
||||
articleInfo.classify1
|
||||
)}`"
|
||||
title="分类"
|
||||
>{{articleInfo.classify1}}</router-link>
|
||||
>{{ articleInfo.classify1 }}</router-link
|
||||
>
|
||||
<span v-else>{{ articleInfo.classify1 }}</span>
|
||||
</li>
|
||||
<li v-if="articleInfo.classify2">
|
||||
<router-link
|
||||
v-if="articleInfo.cataloguePermalink"
|
||||
:to="articleInfo.cataloguePermalink + '/#' + articleInfo.classify2"
|
||||
:title="articleInfo.classify1+'#'+articleInfo.classify2"
|
||||
>{{articleInfo.classify2}}</router-link>
|
||||
:title="articleInfo.classify1 + '#' + articleInfo.classify2"
|
||||
>{{ articleInfo.classify2 }}</router-link
|
||||
>
|
||||
<router-link
|
||||
v-else-if="$themeConfig.category !== false"
|
||||
:to="`/categories/?category=${encodeURIComponent(articleInfo.classify2)}`"
|
||||
:to="`/categories/?category=${encodeURIComponent(
|
||||
articleInfo.classify2
|
||||
)}`"
|
||||
title="分类"
|
||||
>{{articleInfo.classify2}}</router-link>
|
||||
<span v-else>{{articleInfo.classify2}}</span>
|
||||
>{{ articleInfo.classify2 }}</router-link
|
||||
>
|
||||
<span v-else>{{ articleInfo.classify2 }}</span>
|
||||
</li>
|
||||
<li v-if="articleInfo.classify3">
|
||||
<router-link
|
||||
v-if="articleInfo.cataloguePermalink"
|
||||
:to="articleInfo.cataloguePermalink + '/#' + articleInfo.classify3"
|
||||
:title="articleInfo.classify1+'#'+articleInfo.classify3"
|
||||
>{{articleInfo.classify3}}</router-link>
|
||||
:title="articleInfo.classify1 + '#' + articleInfo.classify3"
|
||||
>{{ articleInfo.classify3 }}</router-link
|
||||
>
|
||||
<router-link
|
||||
v-else-if="$themeConfig.category !== false"
|
||||
:to="`/categories/?category=${encodeURIComponent(articleInfo.classify3)}`"
|
||||
:to="`/categories/?category=${encodeURIComponent(
|
||||
articleInfo.classify3
|
||||
)}`"
|
||||
title="分类"
|
||||
>{{articleInfo.classify3}}</router-link>
|
||||
<span v-else>{{articleInfo.classify3}}</span>
|
||||
>{{ articleInfo.classify3 }}</router-link
|
||||
>
|
||||
<span v-else>{{ articleInfo.classify3 }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="info">
|
||||
|
|
@ -60,33 +68,42 @@
|
|||
>
|
||||
<a
|
||||
:href="articleInfo.author.href || articleInfo.author.link"
|
||||
v-if="articleInfo.author.href || articleInfo.author.link && typeof(articleInfo.author.link) === 'string'"
|
||||
v-if="
|
||||
articleInfo.author.href ||
|
||||
(articleInfo.author.link &&
|
||||
typeof articleInfo.author.link === 'string')
|
||||
"
|
||||
target="_blank"
|
||||
class="beLink"
|
||||
title="作者"
|
||||
>{{articleInfo.author.name}}</a>
|
||||
<a
|
||||
v-else
|
||||
href="javascript:;"
|
||||
>{{articleInfo.author.name || articleInfo.author}}</a>
|
||||
>{{ articleInfo.author.name }}</a
|
||||
>
|
||||
<a v-else href="javascript:;">{{
|
||||
articleInfo.author.name || articleInfo.author
|
||||
}}</a>
|
||||
</div>
|
||||
<div
|
||||
class="date iconfont icon-riqi"
|
||||
title="创建时间"
|
||||
v-if="articleInfo.date"
|
||||
>
|
||||
<a href="javascript:;">{{articleInfo.date}}</a>
|
||||
<a href="javascript:;">{{ articleInfo.date }}</a>
|
||||
</div>
|
||||
<div
|
||||
class="date iconfont icon-wenjian"
|
||||
title="分类"
|
||||
v-if="$themeConfig.category !== false && !(articleInfo.classify1 && articleInfo.classify1 !== '_posts') && articleInfo.categories"
|
||||
v-if="
|
||||
$themeConfig.category !== false &&
|
||||
!(articleInfo.classify1 && articleInfo.classify1 !== '_posts') &&
|
||||
articleInfo.categories
|
||||
"
|
||||
>
|
||||
<router-link
|
||||
:to="`/categories/?category=${encodeURIComponent(item)}`"
|
||||
v-for="(item, index) in articleInfo.categories"
|
||||
:key="index"
|
||||
>{{item + ' '}}</router-link>
|
||||
>{{ item + ' ' }}</router-link
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -123,7 +140,6 @@ export default {
|
|||
const classify3 = relativePathArr.length > 3 ? relativePathArr[2].split('.')[1] : undefined// 文章三级分类名称
|
||||
|
||||
const cataloguePermalink = sidebar && sidebar.catalogue ? sidebar.catalogue[classify1] : undefined// 目录页永久链接
|
||||
|
||||
const author = this.$frontmatter.author || this.$themeConfig.author // 作者
|
||||
let date = (pageInfo.frontmatter.date || '').split(' ')[0] // 文章创建时间
|
||||
|
||||
|
|
|
|||
|
|
@ -1,29 +1,22 @@
|
|||
<template>
|
||||
<aside class="blogger-wrapper card-box">
|
||||
<div class="avatar">
|
||||
<img
|
||||
:src="blogger.avatar"
|
||||
alt="头像"
|
||||
title="我好看吗"
|
||||
/>
|
||||
<img :src="blogger.avatar" alt="头像" title="我好看吗" />
|
||||
</div>
|
||||
<div
|
||||
class="icons"
|
||||
v-if="social && social.icons && social.icons.length"
|
||||
>
|
||||
<div class="icons" v-if="social && social.icons && social.icons.length">
|
||||
<a
|
||||
v-for="(item, index) in social.icons"
|
||||
:key="index"
|
||||
:href="item.link"
|
||||
:title="item.title"
|
||||
:class="['iconfont', item.iconClass]"
|
||||
:style="{width: 100/social.icons.length + '%'}"
|
||||
:style="{ width: 100 / social.icons.length + '%' }"
|
||||
target="_blank"
|
||||
/>
|
||||
</div>
|
||||
<div class="blogger">
|
||||
<span class="name">{{blogger.name}}</span>
|
||||
<span class="slogan">{{blogger.slogan}}</span>
|
||||
<span class="name">{{ blogger.name }}</span>
|
||||
<span class="slogan">{{ blogger.slogan }}</span>
|
||||
</div>
|
||||
</aside>
|
||||
</template>
|
||||
|
|
@ -45,7 +38,7 @@ export default {
|
|||
.blogger-wrapper
|
||||
height auto
|
||||
display inline-table
|
||||
padding-top 0!important
|
||||
padding-top 0 !important
|
||||
overflow hidden
|
||||
.avatar
|
||||
width 100%
|
||||
|
|
|
|||
|
|
@ -33,9 +33,11 @@
|
|||
v-for="item in modeList"
|
||||
:key="item.KEY"
|
||||
class="iconfont"
|
||||
:class="[item.icon, {active: item.KEY === currentMode}]"
|
||||
:class="[item.icon, { active: item.KEY === currentMode }]"
|
||||
@click="toggleMode(item.KEY)"
|
||||
>{{item.name}}</li>
|
||||
>
|
||||
{{ item.name }}
|
||||
</li>
|
||||
</ul>
|
||||
</transition>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,53 +3,34 @@
|
|||
<div class="column-wrapper">
|
||||
<img :src="$withBase(pageData.imgUrl)" />
|
||||
<dl class="column-info">
|
||||
<dt class="title">{{pageData.title}}</dt>
|
||||
<dd
|
||||
class="description"
|
||||
v-html="pageData.description"
|
||||
></dd>
|
||||
<dt class="title">{{ pageData.title }}</dt>
|
||||
<dd class="description" v-html="pageData.description"></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div
|
||||
class="catalogue-wrapper"
|
||||
v-if="isStructuring"
|
||||
>
|
||||
<div class="catalogue-wrapper" v-if="isStructuring">
|
||||
<div class="catalogue-title">目录</div>
|
||||
<div class="catalogue-content">
|
||||
<template v-for="(item, index) in getCatalogueList()">
|
||||
<dl
|
||||
v-if="type(item) === 'array'"
|
||||
:key="index"
|
||||
class="inline"
|
||||
>
|
||||
<dl v-if="type(item) === 'array'" :key="index" class="inline">
|
||||
<dt>
|
||||
<router-link :to="item[2]">{{`${index+1}. ${item[1]}`}}</router-link>
|
||||
<router-link :to="item[2]">{{
|
||||
`${index + 1}. ${item[1]}`
|
||||
}}</router-link>
|
||||
</dt>
|
||||
</dl>
|
||||
<dl
|
||||
v-else-if="type(item) === 'object'"
|
||||
:key="index"
|
||||
>
|
||||
<dl v-else-if="type(item) === 'object'" :key="index">
|
||||
<!-- 一级目录 -->
|
||||
<dt :id="anchorText = item.title">
|
||||
<a
|
||||
:href="`#${anchorText}`"
|
||||
class="header-anchor"
|
||||
>#</a>
|
||||
{{`${index+1}. ${item.title}`}}
|
||||
<dt :id="(anchorText = item.title)">
|
||||
<a :href="`#${anchorText}`" class="header-anchor">#</a>
|
||||
{{ `${index + 1}. ${item.title}` }}
|
||||
</dt>
|
||||
<dd>
|
||||
<!-- 二级目录 -->
|
||||
<template
|
||||
v-for="(c, i) in item.children"
|
||||
>
|
||||
<template
|
||||
v-if="type(c) === 'array'"
|
||||
>
|
||||
<router-link
|
||||
:to="c[2]"
|
||||
:key="i"
|
||||
>{{`${index+1}-${i+1}. ${c[1]}`}}</router-link>
|
||||
<template v-for="(c, i) in item.children">
|
||||
<template v-if="type(c) === 'array'">
|
||||
<router-link :to="c[2]" :key="i">{{
|
||||
`${index + 1}-${i + 1}. ${c[1]}`
|
||||
}}</router-link>
|
||||
</template>
|
||||
<!-- 三级目录 -->
|
||||
<div
|
||||
|
|
@ -57,19 +38,16 @@
|
|||
:key="i"
|
||||
class="sub-cat-wrap"
|
||||
>
|
||||
<div :id="anchorText = c.title" class="sub-title">
|
||||
<a
|
||||
:href="`#${anchorText}`"
|
||||
class="header-anchor"
|
||||
>#</a>
|
||||
{{`${index+1}-${i+1}. ${c.title}`}}
|
||||
<div :id="(anchorText = c.title)" class="sub-title">
|
||||
<a :href="`#${anchorText}`" class="header-anchor">#</a>
|
||||
{{ `${index + 1}-${i + 1}. ${c.title}` }}
|
||||
</div>
|
||||
<router-link
|
||||
v-for="(cc, ii) in c.children"
|
||||
:to="cc[2]"
|
||||
:key="`${index+1}-${i+1}-${ii+1}`"
|
||||
:key="`${index + 1}-${i + 1}-${ii + 1}`"
|
||||
>
|
||||
{{`${index+1}-${i+1}-${ii+1}. ${cc[1]}`}}
|
||||
{{ `${index + 1}-${i + 1}-${ii + 1}. ${cc[1]}` }}
|
||||
</router-link>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -87,12 +65,11 @@ export default {
|
|||
return {
|
||||
pageData: null,
|
||||
isStructuring: true,
|
||||
appointDir:{}
|
||||
appointDir: {}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getPageData()
|
||||
|
||||
const sidebar = this.$themeConfig.sidebar
|
||||
if (!sidebar || sidebar === 'auto') {
|
||||
this.isStructuring = false
|
||||
|
|
@ -122,7 +99,7 @@ export default {
|
|||
catalogueList = this.appointDirDeal(0, keyArray, catalogueList);
|
||||
}
|
||||
if (!catalogueList) {
|
||||
console.error('未获取到目录数据,请查看front matter中设置的key是否正确。')
|
||||
console.error('未获取到目录数据,请查看front matter中设置的path是否正确。')
|
||||
}
|
||||
return catalogueList
|
||||
},
|
||||
|
|
@ -136,7 +113,7 @@ export default {
|
|||
* @param catalogueList 目录对象列表
|
||||
* @returns {*}
|
||||
*/
|
||||
appointDirDeal(index, dirKeyArray, catalogueList) {
|
||||
appointDirDeal (index, dirKeyArray, catalogueList) {
|
||||
let dirKey = dirKeyArray[index];
|
||||
if (dirKey !== undefined && dirKey.indexOf(".") !== -1) {
|
||||
dirKey = dirKey.substring(dirKey.indexOf('.') + 1);
|
||||
|
|
@ -217,7 +194,7 @@ dl, dd
|
|||
width 100%
|
||||
.sub-cat-wrap
|
||||
margin 5px 0 8px 0
|
||||
font-size .95rem
|
||||
font-size 0.95rem
|
||||
&> a
|
||||
padding-left 1rem
|
||||
box-sizing border-box
|
||||
|
|
|
|||
|
|
@ -4,23 +4,25 @@
|
|||
to="/categories/"
|
||||
class="title iconfont icon-wenjianjia"
|
||||
title="全部分类"
|
||||
>{{ length === 'all' ? '全部分类' : '文章分类' }}</router-link>
|
||||
>{{ length === 'all' ? '全部分类' : '文章分类' }}</router-link
|
||||
>
|
||||
|
||||
<div class="categories">
|
||||
<router-link
|
||||
:to="`/categories/?category=${encodeURIComponent(item.key)}`"
|
||||
v-for="(item, index) in categories"
|
||||
:key="index"
|
||||
:class="{active: item.key === category}"
|
||||
:class="{ active: item.key === category }"
|
||||
>
|
||||
{{item.key}}
|
||||
<span>{{item.length}}</span>
|
||||
{{ item.key }}
|
||||
<span>{{ item.length }}</span>
|
||||
</router-link>
|
||||
<router-link
|
||||
to="/categories/"
|
||||
v-if="length !== 'all' && length < categoriesData.length"
|
||||
class="more"
|
||||
>更多 ...</router-link>
|
||||
>更多 ...</router-link
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -59,20 +61,20 @@ export default {
|
|||
color var(--textColor)
|
||||
opacity 0.9
|
||||
font-size 1.2rem
|
||||
padding 0 .95rem
|
||||
padding 0 0.95rem
|
||||
&::before
|
||||
margin-right 0.3rem
|
||||
.categories
|
||||
margin-top 0.6rem
|
||||
a
|
||||
display block
|
||||
padding 8px .95rem 7px .95rem
|
||||
padding 8px 0.95rem 7px 0.95rem
|
||||
color var(--textColor)
|
||||
opacity 0.8
|
||||
font-size 0.95rem
|
||||
line-height 0.95rem
|
||||
position relative
|
||||
transition all .2s
|
||||
transition all 0.2s
|
||||
border-left 2px solid transparent
|
||||
margin-top -1px
|
||||
overflow hidden
|
||||
|
|
@ -107,7 +109,6 @@ export default {
|
|||
padding-left 0.8rem
|
||||
border-radius 1px
|
||||
border-color transparent
|
||||
.theme-mode-dark .categories-wrapper .categories a:not(.active):hover,
|
||||
.theme-mode-read .categories-wrapper .categories a:not(.active):hover
|
||||
.theme-mode-dark .categories-wrapper .categories a:not(.active):hover, .theme-mode-read .categories-wrapper .categories a:not(.active):hover
|
||||
background var(--customBlockBg)
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ export default {
|
|||
.categories-page
|
||||
.categories-wrapper
|
||||
position sticky
|
||||
top ($navbarHeight + 0.9rem)
|
||||
top: ($navbarHeight + 0.9rem)
|
||||
max-height calc(100vh - 10rem)
|
||||
min-height 4.2rem
|
||||
@media (max-width $MQMobile)
|
||||
|
|
|
|||
|
|
@ -1,34 +1,20 @@
|
|||
<template>
|
||||
<div
|
||||
class="dropdown-wrapper"
|
||||
:class="{ open }"
|
||||
>
|
||||
<div class="dropdown-wrapper" :class="{ open }">
|
||||
<button
|
||||
class="dropdown-title"
|
||||
type="button"
|
||||
:aria-label="dropdownAriaLabel"
|
||||
@click="toggle"
|
||||
>
|
||||
<router-link
|
||||
v-if="item.link"
|
||||
:to="item.link"
|
||||
class="link-title"
|
||||
>{{ item.text }}</router-link>
|
||||
<span
|
||||
class="title"
|
||||
v-show="!item.link"
|
||||
>{{ item.text }}</span>
|
||||
<span
|
||||
class="arrow"
|
||||
:class="open ? 'down' : 'right'"
|
||||
></span>
|
||||
<router-link v-if="item.link" :to="item.link" class="link-title">{{
|
||||
item.text
|
||||
}}</router-link>
|
||||
<span class="title" v-show="!item.link">{{ item.text }}</span>
|
||||
<span class="arrow" :class="open ? 'down' : 'right'"></span>
|
||||
</button>
|
||||
|
||||
<DropdownTransition>
|
||||
<ul
|
||||
class="nav-dropdown"
|
||||
v-show="open"
|
||||
>
|
||||
<ul class="nav-dropdown" v-show="open">
|
||||
<li
|
||||
class="dropdown-item"
|
||||
:key="subItem.link || index"
|
||||
|
|
@ -36,10 +22,7 @@
|
|||
>
|
||||
<h4 v-if="subItem.type === 'links'">{{ subItem.text }}</h4>
|
||||
|
||||
<ul
|
||||
class="dropdown-subitem-wrapper"
|
||||
v-if="subItem.type === 'links'"
|
||||
>
|
||||
<ul class="dropdown-subitem-wrapper" v-if="subItem.type === 'links'">
|
||||
<li
|
||||
class="dropdown-subitem"
|
||||
:key="childSubItem.link"
|
||||
|
|
@ -48,8 +31,8 @@
|
|||
<NavLink
|
||||
@focusout="
|
||||
isLastItemOfArray(childSubItem, subItem.items) &&
|
||||
isLastItemOfArray(subItem, item.items) &&
|
||||
toggle()
|
||||
isLastItemOfArray(subItem, item.items) &&
|
||||
toggle()
|
||||
"
|
||||
:item="childSubItem"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -30,10 +30,7 @@
|
|||
</header>
|
||||
|
||||
<!-- PC端features块 s -->
|
||||
<div
|
||||
class="features"
|
||||
v-if="homeData.features && homeData.features.length && !isMQMobile"
|
||||
>
|
||||
<div class="features" v-if="hasFeatures && !isMQMobile">
|
||||
<div
|
||||
class="feature"
|
||||
v-for="(feature, index) in homeData.features"
|
||||
|
|
@ -66,11 +63,7 @@
|
|||
|
||||
<!-- 移动端features块 s -->
|
||||
<!-- isMQMobile放到v-if上线后会报错 -->
|
||||
<div
|
||||
class="slide-banner"
|
||||
v-if="homeData.features && homeData.features.length"
|
||||
v-show="isMQMobile"
|
||||
>
|
||||
<div class="slide-banner" v-if="hasFeatures" v-show="isMQMobile">
|
||||
<div class="banner-wrapper">
|
||||
<div class="slide-banner-scroll" ref="slide">
|
||||
<div class="slide-banner-wrapper">
|
||||
|
|
@ -199,6 +192,14 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
homeData () {
|
||||
return {
|
||||
...this.$page.frontmatter
|
||||
}
|
||||
},
|
||||
hasFeatures () {
|
||||
return !!(this.homeData.features && this.homeData.features.length)
|
||||
},
|
||||
homeSidebarB () {
|
||||
const { htmlModules } = this.$themeConfig
|
||||
return htmlModules ? htmlModules.homeSidebarB : ''
|
||||
|
|
@ -230,11 +231,6 @@ export default {
|
|||
}
|
||||
|
||||
},
|
||||
homeData () {
|
||||
return {
|
||||
...this.$page.frontmatter
|
||||
}
|
||||
},
|
||||
actionLink () {
|
||||
return {
|
||||
link: this.homeData.actionLink,
|
||||
|
|
@ -254,20 +250,21 @@ export default {
|
|||
this.currentPage = Number(this.$route.query.p)
|
||||
}
|
||||
|
||||
if (this.isMQMobile && (!this.$route.query.p || this.$route.query.p == 1)) {
|
||||
if (this.hasFeatures && this.isMQMobile && (!this.$route.query.p || this.$route.query.p == 1)) {
|
||||
this.init()
|
||||
}
|
||||
|
||||
window.addEventListener('resize', () => {
|
||||
this.isMQMobile = window.innerWidth < MOBILE_DESKTOP_BREAKPOINT ? true : false;
|
||||
if (this.isMQMobile && !this.slide && !this.mark) {
|
||||
this.mark++
|
||||
setTimeout(() => {
|
||||
this.init()
|
||||
}, 60)
|
||||
}
|
||||
})
|
||||
|
||||
if (this.hasFeatures) {
|
||||
window.addEventListener('resize', () => {
|
||||
this.isMQMobile = window.innerWidth < MOBILE_DESKTOP_BREAKPOINT ? true : false;
|
||||
if (this.isMQMobile && !this.slide && !this.mark) {
|
||||
this.mark++
|
||||
setTimeout(() => {
|
||||
this.init()
|
||||
}, 60)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
clearTimeout(this.playTimer)
|
||||
|
|
@ -281,7 +278,7 @@ export default {
|
|||
this.currentPage = Number(this.$route.query.p)
|
||||
}
|
||||
|
||||
if (this.currentPage === 1 && this.isMQMobile) {
|
||||
if (this.hasFeatures && this.currentPage === 1 && this.isMQMobile) {
|
||||
setTimeout(() => {
|
||||
this.slide && this.slide.destroy()
|
||||
this.init()
|
||||
|
|
@ -467,7 +464,7 @@ export default {
|
|||
.banner.hide-banner
|
||||
display none
|
||||
& + .main-wrapper
|
||||
margin-top ($navbarHeight + 0.9rem)
|
||||
margin-top: ($navbarHeight + 0.9rem)
|
||||
.main-wrapper
|
||||
margin-top 2rem
|
||||
.main-left
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ function createSidebarData (sourceDir, collapsable) {
|
|||
const tocs = readTocs(sourceDir);
|
||||
tocs.forEach(toc => { // toc是每个目录的绝对路径
|
||||
|
||||
const tocArr = toc.split('\\')
|
||||
if (tocArr[tocArr.length - 1] === '_posts') { // 碎片化文章
|
||||
if (toc.substr(-6) === '_posts') { // 碎片化文章
|
||||
|
||||
// 注释说明:碎片化文章不需要生成结构化侧边栏 2020.05.01
|
||||
// const sidebarArr = mapTocToPostSidebar(toc);
|
||||
|
|
@ -112,6 +111,9 @@ function mapTocToSidebar (root, collapsable, prefix = '') {
|
|||
files.forEach(filename => {
|
||||
const file = path.resolve(root, filename); // 方法:将路径或路径片段的序列解析为绝对路径
|
||||
const stat = fs.statSync(file); // 文件信息
|
||||
if (filename === '.DS_Store') { // 过滤.DS_Store文件
|
||||
return
|
||||
}
|
||||
let [order, title, type] = filename.split('.');
|
||||
order = parseInt(order, 10);
|
||||
if (isNaN(order) || order < 0) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "vuepress-theme-vdoing",
|
||||
"version": "1.8.1",
|
||||
"version": "1.8.2",
|
||||
"description": "Vdoing theme for VuePress. 一个基于VuePress的知识管理兼博客主题。",
|
||||
"author": {
|
||||
"name": "gaoyi(Evan) Xu"
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ $mobileSidebarWidth = $sidebarWidth * 0.9
|
|||
padding-right .8rem
|
||||
&.have-rightmenu
|
||||
.page
|
||||
padding-right ($rightMenuWidth + .8rem)
|
||||
padding-right ($rightMenuWidth + 20rem)
|
||||
&.no-sidebar
|
||||
.page
|
||||
padding-left 0!important
|
||||
|
|
|
|||
|
|
@ -270,10 +270,10 @@ export function zero (d) {
|
|||
|
||||
// 获取时间的时间戳
|
||||
export function getTimeNum (post) {
|
||||
let dateStr = post.frontmatter.date || post.lastUpdated
|
||||
let dateStr = post.frontmatter.date || post.lastUpdated || new Date()
|
||||
let date = new Date(dateStr)
|
||||
if (date == "Invalid Date") { // 修复new Date()在Safari下出现Invalid Date的问题
|
||||
date = new Date(dateStr.replace(/-/g, '/'))
|
||||
if (date == "Invalid Date" && dateStr) { // 修复new Date()在Safari下出现Invalid Date的问题
|
||||
date = new Date(dateStr?.replace(/-/g, '/'))
|
||||
}
|
||||
return date.getTime()
|
||||
}
|
||||
|
|
@ -286,6 +286,6 @@ export function compareDate (a, b) {
|
|||
// 将特殊符号编码(应用于url)
|
||||
export function encodeUrl (str) {
|
||||
str = str + ''
|
||||
str = str.replace(/ |((?=[\x21-\x7e]+)[^A-Za-z0-9])/g, '-')
|
||||
str = str?.replace(/ |((?=[\x21-\x7e]+)[^A-Za-z0-9])/g, '-')
|
||||
return str
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue