Skip to content

Commit 245b6de

Browse files
author
reco_luan
authored
Merge pull request #101 from vuepress-reco/feature/reco
Feature/reco
2 parents 6ba8320 + 85c90d0 commit 245b6de

File tree

9 files changed

+51
-21
lines changed

9 files changed

+51
-21
lines changed

components/HomeBlog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export default {
321321
padding-right: 1.5rem;
322322
.hero {
323323
margin 0 -1.5rem
324-
height 350px
324+
height 450px
325325
img {
326326
max-height: 210px;
327327
margin: 2rem auto 1.2rem;

components/Password.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<template>
22
<div class="password-shadow" :class="{'is-home': !isPage}">
3-
<!-- <Background /> -->
43
<h3 class="title">{{isPage ? $frontmatter.title : $site.title}}</h3>
54
<p class="description" v-if="!isPage">{{$site.description}}</p>
65
<label class="inputBox" id="box">
@@ -32,10 +31,7 @@
3231
</template>
3332

3433
<script>
35-
import Background from '@theme/components/Background'
36-
3734
export default {
38-
components: { Background },
3935
props: {
4036
isPage: {
4137
type: Boolean,
@@ -157,6 +153,7 @@ export default {
157153
padding-left 20px
158154
box-sizing border-box
159155
opacity 0.9
156+
overflow hidden
160157
input{
161158
width:600px;
162159
height:100%;
@@ -168,6 +165,7 @@ export default {
168165
outline: none;
169166
position: absolute;
170167
bottom:0;
168+
left 20px
171169
opacity 0
172170
font-size 50px
173171
&:focus {
@@ -249,7 +247,7 @@ export default {
249247
box-sizing border-box
250248
opacity 0.9
251249
input{
252-
width:600px;
250+
width: 60%;
253251
height:100%;
254252
border:none;
255253
padding:0;
@@ -313,7 +311,7 @@ export default {
313311
@media (max-width: $MQNarrow) {
314312
.inputBox{
315313
padding-left $mobileSidebarWidth
316-
}
314+
}
317315
}
318316
}
319317

components/SidebarLink.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ function renderChildren (h, children, path, route, maxDepth, depth = 1) {
8282
padding-left 1.5rem
8383
font-size 0.95em
8484
85+
.sidebar-sub-headers a.sidebar-link
86+
margin 0 1rem 0 0.6rem
87+
8588
a.sidebar-link
8689
font-size 1em
8790
font-weight 400

components/TagList.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export default {
4747
border-radius: $borderRadius
4848
background: #fff;
4949
color: #fff;
50+
line-height 13px
5051
font-size: 13px;
5152
box-shadow $boxShadow
5253
transition: all .5s

example/docs/views/other/guide.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: vuepress-theme-reco
33
date: 2019-04-09
4+
categories:
5+
- other
46
---
57

68
![vuepress](https://img.shields.io/badge/vuepress-0.14.8-brightgreen.svg)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: Installation and reference
3+
date: 2019-04-09
4+
categories:
5+
- other
6+
---
7+
8+
## Install
9+
10+
```bash
11+
npm install vuepress-theme-reco -dev--save
12+
13+
# or
14+
15+
yarn add vuepress-theme-reco
16+
```
17+
18+
## Usage
19+
20+
```javascript
21+
// .vuepress/config.js
22+
23+
module.exports = {
24+
theme: 'reco'
25+
}
26+
```

layouts/Category.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export default {
5454
// 时间降序后的博客列表
5555
posts () {
5656
let posts = this.$currentCategories.pages
57-
this._sortPostData(posts)
5857
posts = this._filterPostData(posts)
58+
this._sortPostData(posts)
5959
return posts
6060
},
6161
// 标题只显示分类名称

layouts/Tag.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ export default {
4545
// 时间降序后的博客列表
4646
posts () {
4747
let posts = this.$currentTags.pages
48-
this._sortPostData(posts)
4948
posts = this._filterPostData(posts)
49+
this._sortPostData(posts)
5050
return posts
5151
}
5252
},

mixins/index.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
export default {
22
methods: {
33
_tagColor () {
4-
// 红、蓝、绿、橙、灰
54
const tagColorArr = ['#e15b64', '#f47e60', '#f8b26a', '#abbd81', '#849b87', '#e15b64', '#f47e60', '#f8b26a', '#f26d6d', '#67cc86', '#fb9b5f', '#3498db']
65
const index = Math.floor(Math.random() * tagColorArr.length)
76
return tagColorArr[index]
87
},
98
_filterPostData (posts, isTimeline) {
109
posts = posts.filter(item => {
11-
const { title, frontmatter: { home, date, publish, sticky }} = item
10+
const { title, frontmatter: { home, date, publish }} = item
1211
return isTimeline === true
1312
? !(home == true || title == undefined || date === undefined || publish === false)
1413
: !(home == true || title == undefined || publish === false)
@@ -17,23 +16,24 @@ export default {
1716
},
1817
_sortPostData (posts) {
1918
posts.sort((a, b) => {
20-
let aSticky = a.frontmatter.sticky, bSticky=b.frontmatter.sticky;
21-
if(aSticky && bSticky) {
22-
return aSticky == bSticky ? this._compareTime(a,b) : (aSticky - bSticky)
23-
} else if(aSticky && !bSticky) {
24-
return -1;
25-
} else if(!aSticky && bSticky){
26-
return 1;
19+
const aSticky = a.frontmatter.sticky
20+
const bSticky = b.frontmatter.sticky
21+
if (aSticky && bSticky) {
22+
return aSticky == bSticky ? this._compareTime(a, b) : (aSticky - bSticky)
23+
} else if (aSticky && !bSticky) {
24+
return -1
25+
} else if (!aSticky && bSticky) {
26+
return 1
2727
}
28-
return this._compareTime(a,b)
28+
return this._compareTime(a, b)
2929
})
3030
},
3131
// 获取时间的数字类型
3232
_getTimeNum (date) {
3333
return parseInt(new Date(date.frontmatter.date).getTime())
3434
},
3535
// 比对时间
36-
_compareTime(a, b) {
36+
_compareTime (a, b) {
3737
return this._getTimeNum(b) - this._getTimeNum(a)
3838
},
3939
// 获取博客数据
@@ -52,7 +52,7 @@ export default {
5252

5353
posts = _filterPostData(posts)
5454
_sortPostData(posts)
55-
55+
5656
this.$themeConfig.posts = posts
5757
resolve(posts)
5858
}

0 commit comments

Comments
 (0)