Skip to content

Commit 729d1eb

Browse files
author
reco_luan
committed
fix: SSR and anchor points are invalid
1 parent 5233ccc commit 729d1eb

File tree

4 files changed

+70
-33
lines changed

4 files changed

+70
-33
lines changed

components/Common.vue

Lines changed: 61 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,37 @@
55
@touchstart="onTouchStart"
66
@touchend="onTouchEnd">
77
<transition name="fade">
8-
<LoadingPage v-if="firstLoad" />
9-
<Password v-else-if="!isHasKey" />
10-
<div v-else>
11-
<Navbar
12-
v-if="shouldShowNavbar"
13-
@toggle-sidebar="toggleSidebar"/>
14-
15-
<div
16-
class="sidebar-mask"
17-
@click="toggleSidebar(false)"></div>
18-
19-
<Sidebar
20-
:items="sidebarItems"
21-
@toggle-sidebar="toggleSidebar">
22-
<slot
23-
name="sidebar-top"
24-
slot="top"/>
25-
<slot
26-
name="sidebar-bottom"
27-
slot="bottom"/>
28-
</Sidebar>
29-
30-
<Password v-if="!isHasPageKey" :isPage="true"></Password>
31-
<div v-else>
32-
<slot></slot>
33-
<Comments :isShowComments="shouldShowComments"/>
34-
</div>
35-
</div>
8+
<LoadingPage v-show="firstLoad" class="loading-wrapper" />
369
</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"/>
17+
18+
<div
19+
class="sidebar-mask"
20+
@click="toggleSidebar(false)"></div>
21+
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>
32+
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"/>
37+
</div>
38+
</div>
3739
<GA></GA>
3840
</div>
3941
</template>
@@ -202,6 +204,37 @@ export default {
202204
</script>
203205

204206
<style lang="stylus" scoped>
207+
.theme-container
208+
.loading-wrapper
209+
position absolute
210+
z-index 22
211+
top 0
212+
bottom 0
213+
left 0
214+
right 0
215+
margin auto
216+
background #fff
217+
.password-wrapper-out
218+
position absolute
219+
z-index 21
220+
top 0
221+
bottom 0
222+
left 0
223+
right 0
224+
margin auto
225+
background #fff
226+
.password-wrapper-in
227+
position absolute
228+
z-index 8
229+
top 0
230+
bottom 0
231+
left 0
232+
right 0
233+
margin auto
234+
background #fff
235+
.hide
236+
height 100vh
237+
overflow hidden
205238
.theme-container.no-sidebar
206239
.comments-wrapper
207240
padding-left 2rem

components/Password.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="password-shadow" :class="{'is-home': !isPage}">
3-
<Background />
3+
<!-- <Background /> -->
44
<h3 class="title">{{isPage ? $frontmatter.title : $site.title}}</h3>
55
<p class="description" v-if="!isPage">{{$site.description}}</p>
66
<label class="inputBox" id="box">
@@ -73,7 +73,7 @@ export default {
7373
return
7474
}
7575
76-
const width = document.getElementById('box').getClientRects()[0].width
76+
const width = document.getElementById('box').style.width
7777
7878
passwordBtn.style.width = `${width - 2}px`
7979
passwordBtn.style.opacity = 1
@@ -245,7 +245,7 @@ export default {
245245
right 0
246246
top 43%
247247
margin auto
248-
padding-left 20px
248+
padding-left 16.4rem
249249
box-sizing border-box
250250
opacity 0.9
251251
input{
@@ -310,6 +310,11 @@ export default {
310310
}
311311
}
312312
}
313+
@media (max-width: $MQNarrow) {
314+
.inputBox{
315+
padding-left $mobileSidebarWidth
316+
}
317+
}
313318
}
314319
315320
// narrow desktop / iPad

components/SidebarLink.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,4 @@ a.sidebar-link
109109
font-weight 500
110110
background transparent
111111
color $accentColor
112-
margin-left .2rem
113112
</style>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vuepress-theme-reco",
3-
"version": "1.1.1",
3+
"version": "1.1.2-alpha.2",
44
"description": "A simple and beautiful vuepress Blog & Doc theme.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)