commit
0704f2264d
@ -32,7 +32,6 @@
|
||||
<slot></slot>
|
||||
<Comments :isShowComments="isComment"/>
|
||||
</div>
|
||||
<Footer class="footer" />
|
||||
</div>
|
||||
</transition>
|
||||
<GA></GA>
|
||||
@ -41,14 +40,13 @@
|
||||
|
||||
<script>
|
||||
import Navbar from '@theme/components/Navbar.vue'
|
||||
import Footer from '@theme/components/Footer.vue'
|
||||
import Sidebar from '@theme/components/Sidebar.vue'
|
||||
import { resolveSidebarItems } from '../util'
|
||||
import Password from '@theme/components/Password'
|
||||
import { setTimeout } from 'timers'
|
||||
|
||||
export default {
|
||||
components: { Sidebar, Navbar, Password, Footer },
|
||||
components: { Sidebar, Navbar, Password },
|
||||
|
||||
props: ['sidebar', 'isComment'],
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
<span v-if="$themeConfig.author || $site.title">{{ $themeConfig.author || $site.title }}</span>
|
||||
</a>
|
||||
</span>
|
||||
<span v-show="$themeConfig.commentsSolution === 'valine'">
|
||||
<span v-show="$themeConfig.valineConfig !== undefined">
|
||||
<i class="iconfont reco-eye"></i>
|
||||
<AccessNumber idVal="/" />
|
||||
</span>
|
||||
|
@ -57,8 +57,10 @@
|
||||
<script>
|
||||
import TagList from '@theme/components/TagList.vue'
|
||||
import NoteAbstract from '@theme/components/NoteAbstract.vue'
|
||||
import mixin from '@theme/mixins/index.js'
|
||||
|
||||
export default {
|
||||
mixins: [mixin],
|
||||
components: { NoteAbstract, TagList },
|
||||
data () {
|
||||
return {
|
||||
@ -71,13 +73,8 @@ export default {
|
||||
// 时间降序后的博客列表
|
||||
posts () {
|
||||
let posts = this.$site.pages
|
||||
posts = posts.filter(item => {
|
||||
const { home, date } = item.frontmatter
|
||||
return !(home == true || date === undefined)
|
||||
})
|
||||
posts.sort((a, b) => {
|
||||
return this._getTimeNum(b) - this._getTimeNum(a)
|
||||
})
|
||||
posts = this._filterPostData(posts)
|
||||
this._sortPostData(posts)
|
||||
return posts
|
||||
},
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="password-shadow" :class="{'is-home': !isPage}">
|
||||
<Background></Background>
|
||||
<Background />
|
||||
<h3 class="title">{{isPage ? $frontmatter.title : $site.title}}</h3>
|
||||
<p class="description" v-if="!isPage">{{$site.description}}</p>
|
||||
<label class="inputBox" id="box">
|
||||
@ -106,9 +106,9 @@ export default {
|
||||
.password-shadow {
|
||||
width 100vw;
|
||||
height 100vh;
|
||||
background #fff
|
||||
position relative
|
||||
padding-left: 20rem;
|
||||
// background-image: radial-gradient(ellipse farthest-corner at center top,#497EC6 0,#000105 100%);
|
||||
.title {
|
||||
position: absolute;
|
||||
left 0
|
||||
|
@ -36,8 +36,10 @@
|
||||
<script>
|
||||
import Common from '@theme/components/Common.vue'
|
||||
import NoteAbstract from '@theme/components/NoteAbstract.vue'
|
||||
import mixin from '@theme/mixins/index.js'
|
||||
|
||||
export default {
|
||||
mixins: [mixin],
|
||||
components: { Common, NoteAbstract },
|
||||
|
||||
data () {
|
||||
@ -51,10 +53,9 @@ export default {
|
||||
computed: {
|
||||
// 时间降序后的博客列表
|
||||
posts () {
|
||||
const posts = this.$currentCategories.pages
|
||||
posts.sort((a, b) => {
|
||||
return this._getTimeNum(b) - this._getTimeNum(a)
|
||||
})
|
||||
let posts = this.$currentCategories.pages
|
||||
posts = this._filterPostData(posts)
|
||||
this._sortPostData(posts)
|
||||
this._setPage(1)
|
||||
return posts
|
||||
},
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<Common>
|
||||
<component v-if="$frontmatter.home" :is="homeCom"></component>
|
||||
<component v-if="$frontmatter.home" :is="homeCom"></component>
|
||||
<Page
|
||||
v-else
|
||||
:sidebar-items="sidebarItems">
|
||||
@ -12,6 +12,7 @@
|
||||
name="page-bottom"
|
||||
slot="bottom"/>
|
||||
</Page>
|
||||
<Footer v-if="$frontmatter.home" class="footer" />
|
||||
</Common>
|
||||
</div>
|
||||
</template>
|
||||
@ -20,11 +21,12 @@
|
||||
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 '../util'
|
||||
|
||||
export default {
|
||||
components: { HomeBlog, Home, Page, Common },
|
||||
components: { HomeBlog, Home, Page, Common, Footer },
|
||||
|
||||
computed: {
|
||||
sidebarItems () {
|
||||
@ -38,7 +40,7 @@ export default {
|
||||
homeCom () {
|
||||
const { type } = this.$themeConfig
|
||||
if (type !== undefined) {
|
||||
return type == 'blog' ? 'HomeBlog': type
|
||||
return type == 'blog' ? 'HomeBlog' : type
|
||||
}
|
||||
return 'Home'
|
||||
}
|
||||
|
@ -22,8 +22,10 @@
|
||||
import Common from '@theme/components/Common.vue'
|
||||
import TagList from '@theme/components/TagList.vue'
|
||||
import NoteAbstract from '@theme/components/NoteAbstract.vue'
|
||||
import mixin from '@theme/mixins/index.js'
|
||||
|
||||
export default {
|
||||
mixins: [mixin],
|
||||
components: { Common, NoteAbstract, TagList },
|
||||
data () {
|
||||
return {
|
||||
@ -39,13 +41,8 @@ export default {
|
||||
// 时间降序后的博客列表
|
||||
handlePosts () {
|
||||
let posts = this.$site.pages
|
||||
posts = posts.filter(item => {
|
||||
const { home, date } = item.frontmatter
|
||||
return !(home == true || date === undefined)
|
||||
})
|
||||
posts.sort((a, b) => {
|
||||
return this._getTimeNum(b) - this._getTimeNum(a)
|
||||
})
|
||||
posts = this._filterPostData(posts)
|
||||
this._sortPostData(posts)
|
||||
return posts
|
||||
}
|
||||
},
|
||||
@ -75,9 +72,7 @@ export default {
|
||||
let posts = []
|
||||
if (currentTag !== '全部') {
|
||||
posts = this.$tags.map[currentTag].pages
|
||||
posts.sort((a, b) => {
|
||||
return this._getTimeNum(b) - this._getTimeNum(a)
|
||||
})
|
||||
this._sortPostData(posts)
|
||||
} else {
|
||||
posts = this.handlePosts
|
||||
}
|
||||
@ -101,10 +96,6 @@ export default {
|
||||
_setPage (page) {
|
||||
this.currentPage = page
|
||||
this.$page.currentPage = page
|
||||
},
|
||||
// 获取时间的数字类型
|
||||
_getTimeNum (date) {
|
||||
return parseInt(new Date(date.frontmatter.date).getTime())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,10 @@
|
||||
|
||||
<script>
|
||||
import Common from '@theme/components/Common.vue'
|
||||
import mixin from '@theme/mixins/index.js'
|
||||
|
||||
export default {
|
||||
mixins: [mixin],
|
||||
name: 'TimeLine',
|
||||
components: { Common },
|
||||
data () {
|
||||
@ -52,10 +54,7 @@ export default {
|
||||
// 根据分类获取页面数据
|
||||
getPages (tag) {
|
||||
let pages = this.$site.pages
|
||||
pages = pages.filter(item => {
|
||||
const { home, isTimeLine, date } = item.frontmatter
|
||||
return !(home == true || isTimeLine == true || date === undefined)
|
||||
})
|
||||
pages = this._filterPostData(pages)
|
||||
// reverse()是为了按时间最近排序排序
|
||||
this.pages = pages.length == 0 ? [] : pages
|
||||
for (let i = 0, length = pages.length; i < length; i++) {
|
||||
@ -68,11 +67,11 @@ export default {
|
||||
}
|
||||
|
||||
for (const key in this.formatPages) {
|
||||
const data = this.formatPages[key]
|
||||
this._sortPostData(data)
|
||||
this.formatPagesArr.unshift({
|
||||
year: key,
|
||||
data: this.formatPages[key].sort((a, b) => {
|
||||
return this._getTimeNum(b) - this._getTimeNum(a)
|
||||
})
|
||||
data
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -5,6 +5,22 @@ export default {
|
||||
const tagColorArr = ['#e15b64', '#f47e60', '#f8b26a', '#abbd81', '#849b87', '#e15b64', '#f47e60', '#f8b26a', '#f26d6d', '#67cc86', '#fb9b5f', '#3498db']
|
||||
const index = Math.floor(Math.random() * tagColorArr.length)
|
||||
return tagColorArr[index]
|
||||
},
|
||||
_filterPostData (posts) {
|
||||
posts = posts.filter(item => {
|
||||
const { home, date, publish } = item.frontmatter
|
||||
return !(home == true || date === undefined || publish === false)
|
||||
})
|
||||
return posts
|
||||
},
|
||||
_sortPostData (posts) {
|
||||
posts.sort((a, b) => {
|
||||
return this._getTimeNum(b) - this._getTimeNum(a)
|
||||
})
|
||||
},
|
||||
// 获取时间的数字类型
|
||||
_getTimeNum (date) {
|
||||
return parseInt(new Date(date.frontmatter.date).getTime())
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vuepress-theme-reco",
|
||||
"version": "1.0.9-alpha.17",
|
||||
"version": "1.1.0-alpha.1",
|
||||
"description": "this is a vuepress theme",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
Loading…
Reference in New Issue
Block a user