Skip to content

Commit e70903e

Browse files
author
reco_luan
authored
Merge pull request #90 from vuepress-reco/feature/reco
Feature/reco
2 parents b0a1a11 + 6043215 commit e70903e

File tree

7 files changed

+182
-101
lines changed

7 files changed

+182
-101
lines changed

components/AlgoliaSearchBox.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ export default {
7878
line-height normal
7979
.ds-dropdown-menu
8080
background-color #fff
81-
border 1px solid #999
8281
border-radius $borderRadius
83-
font-size 16px
82+
font-size 15px
8483
margin 6px 0 0
8584
padding 4px
8685
text-align left
86+
box-shadow $boxShadow
8787
&:before
88-
border-color #999
88+
display none
8989
[class*=ds-dataset-]
9090
border none
9191
padding 0

components/Common.vue

Lines changed: 66 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,72 @@
44
:class="pageClasses"
55
@touchstart="onTouchStart"
66
@touchend="onTouchEnd">
7-
<transition name="fade">
8-
<LoadingPage v-show="firstLoad" class="loading-wrapper" />
9-
</transition>
10-
<transition name="fade">
11-
<Password v-show="!isHasKey" class="password-wrapper-out" key="out" />
12-
</transition>
13-
<div :class="{ 'hide': firstLoad || !isHasKey }">
14-
<Navbar
15-
v-if="shouldShowNavbar"
16-
@toggle-sidebar="toggleSidebar"/>
7+
<div v-if="absoluteSecrecy">
8+
<transition name="fade">
9+
<LoadingPage v-if="firstLoad" />
10+
<Password v-else-if="!isHasKey" />
11+
<div v-else>
12+
<Navbar
13+
v-if="shouldShowNavbar"
14+
@toggle-sidebar="toggleSidebar"/>
1715

18-
<div
19-
class="sidebar-mask"
20-
@click="toggleSidebar(false)"></div>
16+
<div
17+
class="sidebar-mask"
18+
@click="toggleSidebar(false)"></div>
2119

22-
<Sidebar
23-
:items="sidebarItems"
24-
@toggle-sidebar="toggleSidebar">
25-
<slot
26-
name="sidebar-top"
27-
slot="top"/>
28-
<slot
29-
name="sidebar-bottom"
30-
slot="bottom"/>
31-
</Sidebar>
20+
<Sidebar
21+
:items="sidebarItems"
22+
@toggle-sidebar="toggleSidebar">
23+
<slot
24+
name="sidebar-top"
25+
slot="top"/>
26+
<slot
27+
name="sidebar-bottom"
28+
slot="bottom"/>
29+
</Sidebar>
3230

33-
<Password v-show="!isHasPageKey" :isPage="true" class="password-wrapper-in" key="in"></Password>
34-
<div :class="{ 'hide': !isHasPageKey }">
35-
<slot></slot>
36-
<Comments :isShowComments="shouldShowComments"/>
31+
<Password v-if="!isHasPageKey" :isPage="true"></Password>
32+
<div v-else>
33+
<slot></slot>
34+
<Comments :isShowComments="shouldShowComments"/>
35+
</div>
36+
</div>
37+
</transition>
38+
</div>
39+
<div v-else>
40+
<transition name="fade">
41+
<LoadingPage v-show="firstLoad" class="loading-wrapper" />
42+
</transition>
43+
<transition name="fade">
44+
<Password v-show="!isHasKey" class="password-wrapper-out" key="out" />
45+
</transition>
46+
<div :class="{ 'hide': firstLoad || !isHasKey }">
47+
<Navbar
48+
v-if="shouldShowNavbar"
49+
@toggle-sidebar="toggleSidebar"/>
50+
51+
<div
52+
class="sidebar-mask"
53+
@click="toggleSidebar(false)"></div>
54+
55+
<Sidebar
56+
:items="sidebarItems"
57+
@toggle-sidebar="toggleSidebar">
58+
<slot
59+
name="sidebar-top"
60+
slot="top"/>
61+
<slot
62+
name="sidebar-bottom"
63+
slot="bottom"/>
64+
</Sidebar>
65+
66+
<Password v-show="!isHasPageKey" :isPage="true" class="password-wrapper-in" key="in"></Password>
67+
<div :class="{ 'hide': !isHasPageKey }">
68+
<slot></slot>
69+
<Comments :isShowComments="shouldShowComments"/>
70+
</div>
3771
</div>
3872
</div>
39-
<GA></GA>
4073
</div>
4174
</template>
4275

@@ -71,6 +104,9 @@ export default {
71104
},
72105
73106
computed: {
107+
absoluteSecrecy () {
108+
return this.$themeConfig.keyPage && this.$themeConfig.keyPage.absoluteSecrecy === true
109+
},
74110
// 是否显示评论
75111
shouldShowComments () {
76112
const { isShowComments, home } = this.$frontmatter
@@ -214,7 +250,7 @@ export default {
214250
right 0
215251
margin auto
216252
background #fff
217-
.password-wrapper-out
253+
.password-wrapper-out
218254
position absolute
219255
z-index 21
220256
top 0
@@ -223,7 +259,7 @@ export default {
223259
right 0
224260
margin auto
225261
background #fff
226-
.password-wrapper-in
262+
.password-wrapper-in
227263
position absolute
228264
z-index 8
229265
top 0

components/NoteAbstract.vue

Lines changed: 36 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,52 @@
11
<template>
22
<div class="abstract-wrapper">
3-
<div
4-
v-for="(item, index) in data"
5-
:key="item.path"
6-
v-show="index >= (currentPage * 10 - 10) && index < currentPage * 10"
7-
class="abstract-item">
8-
<div class="title">
9-
<router-link
10-
:to="item.path">{{item.title}}</router-link>
11-
</div>
12-
<div class="abstract" v-html="item.excerpt"></div>
13-
<hr>
14-
<PageInfo :pageInfo="item" :hideAccessNumber="!(hideAccessNumber !== true)" :currentTag="currentTag"></PageInfo>
3+
<div v-if="listLoadType === 'sync'" key="sync">
4+
<NoteAbstractItem
5+
v-for="(item, index) in data"
6+
:key="item.path"
7+
:item="item"
8+
:currentPage="currentPage"
9+
:currentTag="currentTag"
10+
:hideAccessNumber="hideAccessNumber"
11+
v-show="index >= (currentPage * 10 - 10) && index < currentPage * 10"/>
12+
</div>
13+
<div v-else-if="listLoadType === 'async'" key="async">
14+
<NoteAbstractItem
15+
v-for="(item) in currentPageData"
16+
:key="item.path"
17+
:item="item"
18+
:currentPage="currentPage"
19+
:currentTag="currentTag"
20+
:hideAccessNumber="true" />
1521
</div>
1622
</div>
1723
</template>
1824

1925
<script>
20-
import PageInfo from './PageInfo'
26+
import NoteAbstractItem from './NoteAbstractItem'
2127
2228
export default {
23-
components: { PageInfo },
24-
props: ['data', 'currentPage', 'currentTag', 'hideAccessNumber']
29+
components: { NoteAbstractItem },
30+
props: ['data', 'currentPage', 'currentTag', 'hideAccessNumber'],
31+
computed: {
32+
listLoadType () {
33+
const valineConfig = this.$themeConfig.valineConfig
34+
if (valineConfig && !valineConfig.hideListAccessNumber) {
35+
return 'sync'
36+
} else {
37+
return 'async'
38+
}
39+
},
40+
currentPageData () {
41+
const start = this.currentPage * 10 - 10
42+
const end = this.currentPage * 10
43+
return this.data.slice(start, end)
44+
}
45+
}
2546
}
2647
</script>
2748

2849
<style lang="stylus" scoped>
29-
@require '../styles/recoConfig.styl'
30-
3150
.abstract-wrapper
3251
width 100%
33-
.abstract-item
34-
margin: 0 auto 20px;
35-
padding: 16px 20px;
36-
width 100%
37-
overflow: hidden;
38-
border-radius: $borderRadius
39-
box-shadow: $boxShadow;
40-
box-sizing: border-box;
41-
transition all .3s
42-
background-color $bgColor
43-
&:hover
44-
box-shadow: $boxShadowHover
45-
.title
46-
position: relative;
47-
font-size: 1.28rem;
48-
line-height: 36px;
49-
display: inline-block;
50-
:after
51-
content: "";
52-
position: absolute;
53-
width: 100%;
54-
height: 2px;
55-
bottom: 0;
56-
left: 0;
57-
background-color: $accentColor;
58-
visibility: hidden;
59-
-webkit-transform: scaleX(0);
60-
transform: scaleX(0);
61-
transition: .3s ease-in-out;
62-
:hover:after
63-
visibility visible
64-
-webkit-transform: scaleX(1);
65-
transform: scaleX(1);
66-
.tags
67-
.tag-item
68-
cursor: pointer;
69-
&.active
70-
color $accentColor
71-
&:hover
72-
color $accentColor
73-
74-
@media (max-width: $MQMobile)
75-
.tags
76-
display block
77-
margin-top 1rem;
78-
margin-left: 0!important;
7952
</style>

components/NoteAbstractItem.vue

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<template>
2+
<div
3+
class="abstract-item">
4+
<div class="title">
5+
<router-link :to="item.path">{{item.title}}</router-link>
6+
</div>
7+
<div class="abstract" v-html="item.excerpt"></div>
8+
<hr>
9+
<PageInfo
10+
:pageInfo="item"
11+
:hideAccessNumber="!(hideAccessNumber !== true)"
12+
:currentTag="currentTag">
13+
</PageInfo>
14+
</div>
15+
</template>
16+
17+
<script>
18+
import PageInfo from './PageInfo'
19+
20+
export default {
21+
components: { PageInfo },
22+
props: ['item', 'currentPage', 'currentTag', 'hideAccessNumber']
23+
}
24+
</script>
25+
26+
<style lang="stylus" scoped>
27+
@require '../styles/recoConfig.styl'
28+
29+
.abstract-item
30+
margin: 0 auto 20px;
31+
padding: 16px 20px;
32+
width 100%
33+
overflow: hidden;
34+
border-radius: $borderRadius
35+
box-shadow: $boxShadow;
36+
box-sizing: border-box;
37+
transition all .3s
38+
background-color $bgColor
39+
&:hover
40+
box-shadow: $boxShadowHover
41+
.title
42+
position: relative;
43+
font-size: 1.28rem;
44+
line-height: 36px;
45+
display: inline-block;
46+
:after
47+
content: "";
48+
position: absolute;
49+
width: 100%;
50+
height: 2px;
51+
bottom: 0;
52+
left: 0;
53+
background-color: $accentColor;
54+
visibility: hidden;
55+
-webkit-transform: scaleX(0);
56+
transform: scaleX(0);
57+
transition: .3s ease-in-out;
58+
:hover:after
59+
visibility visible
60+
-webkit-transform: scaleX(1);
61+
transform: scaleX(1);
62+
.tags
63+
.tag-item
64+
cursor: pointer;
65+
&.active
66+
color $accentColor
67+
&:hover
68+
color $accentColor
69+
70+
@media (max-width: $MQMobile)
71+
.tags
72+
display block
73+
margin-top 1rem;
74+
margin-left: 0!important;
75+
</style>

components/Page.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@
6363
</p>
6464
</div>
6565

66-
<GA></GA>
67-
6866
<slot name="bottom"/>
6967
</main>
7068
</template>

components/PageInfo.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
<i
99
v-if="pageInfo.frontmatter.date"
1010
class="iconfont reco-date">
11-
<span>{{ pageInfo.frontmatter.date | formatDate }}</span>
11+
<span>{{ pageInfo.frontmatter.date | formatDate }}{{$themeConfig.commentsSolution}}</span>
1212
</i>
1313
<i
14-
v-if="$themeConfig.commentsSolution === 'valine' && hideAccessNumber !== true"
14+
v-if="hideAccessNumber !== true"
1515
class="iconfont reco-eye">
1616
<AccessNumber
1717
:idVal="pageInfo.path"

index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ module.exports = (options, ctx) => ({
2323
'@vuepress-reco/loading-page',
2424
'@vuepress-reco/pagation',
2525
'@vuepress-reco/screenfull',
26-
'@vuepress-reco/ga',
2726
'@vuepress-reco/comments',
2827
'@vuepress/active-header-links',
2928
['@vuepress/medium-zoom', {

0 commit comments

Comments
 (0)