|
4 | 4 | <transition name="fade"> |
5 | 5 | <LoadingPage v-show="firstLoad" class="loading-wrapper" /> |
6 | 6 | </transition> |
| 7 | + |
7 | 8 | <transition name="fade"> |
8 | 9 | <Password v-show="!isHasKey" class="password-wrapper-out" key="out" /> |
9 | 10 | </transition> |
| 11 | + |
10 | 12 | <div :class="{ 'hide': firstLoad || !isHasKey }"> |
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 | | - <template slot="top"> |
23 | | - <PersonalInfo /> |
24 | | - </template> |
25 | | - <slot |
26 | | - name="sidebar-bottom" |
27 | | - slot="bottom"/> |
| 13 | + <Navbar v-if="shouldShowNavbar" @toggle-sidebar="toggleSidebar" /> |
| 14 | + |
| 15 | + <div class="sidebar-mask" @click="toggleSidebar(false)"></div> |
| 16 | + |
| 17 | + <Sidebar :items="sidebarItems" @toggle-sidebar="toggleSidebar"> |
| 18 | + <PersonalInfo slot="top" /> |
| 19 | + <slot name="sidebar-bottom" slot="bottom"/> |
28 | 20 | </Sidebar> |
29 | 21 |
|
30 | 22 | <Password v-show="!isHasPageKey" :isPage="true" class="password-wrapper-in" key="in"></Password> |
|
38 | 30 | <LoadingPage v-if="firstLoad" /> |
39 | 31 | <Password v-else-if="!isHasKey" /> |
40 | 32 | <div v-else> |
41 | | - <Navbar |
42 | | - v-if="shouldShowNavbar" |
43 | | - @toggle-sidebar="toggleSidebar"/> |
44 | | - |
45 | | - <div |
46 | | - class="sidebar-mask" |
47 | | - @click="toggleSidebar(false)"></div> |
48 | | - |
49 | | - <Sidebar |
50 | | - :items="sidebarItems" |
51 | | - @toggle-sidebar="toggleSidebar"> |
52 | | - <template slot="top"> |
53 | | - <PersonalInfo /> |
54 | | - </template> |
55 | | - <slot |
56 | | - name="sidebar-bottom" |
57 | | - slot="bottom"/> |
| 33 | + <Navbar v-if="shouldShowNavbar" @toggle-sidebar="toggleSidebar"/> |
| 34 | + |
| 35 | + <div class="sidebar-mask" @click="toggleSidebar(false)"></div> |
| 36 | + |
| 37 | + <Sidebar :items="sidebarItems" @toggle-sidebar="toggleSidebar"> |
| 38 | + <PersonalInfo slot="top" /> |
| 39 | + <slot name="sidebar-bottom" slot="bottom"/> |
58 | 40 | </Sidebar> |
59 | 41 |
|
60 | 42 | <Password v-if="!isHasPageKey" :isPage="true"></Password> |
61 | | - <div v-else> |
62 | | - <slot></slot> |
63 | | - </div> |
| 43 | + <slot v-else></slot> |
64 | 44 | </div> |
65 | 45 | </transition> |
66 | 46 | </div> |
67 | 47 | </div> |
68 | 48 | </template> |
69 | 49 |
|
70 | 50 | <script> |
71 | | -import { defineComponent, computed, ref, onMounted, watch, reactive } from '@vue/composition-api' |
| 51 | +import { defineComponent, computed, ref, onMounted } from '@vue/composition-api' |
72 | 52 | import Navbar from '@theme/components/Navbar' |
73 | 53 | import Sidebar from '@theme/components/Sidebar' |
74 | 54 | import PersonalInfo from '@theme/components/PersonalInfo' |
@@ -133,6 +113,7 @@ export default defineComponent({ |
133 | 113 | ...userPageClass |
134 | 114 | } |
135 | 115 | }) |
| 116 | +
|
136 | 117 | const hasKey = () => { |
137 | 118 | const { keyPage } = root.$themeConfig |
138 | 119 | if (!keyPage || !keyPage.keys || keyPage.keys.length === 0) { |
@@ -178,12 +159,7 @@ export default defineComponent({ |
178 | 159 | handleLoading() |
179 | 160 | }) |
180 | 161 |
|
181 | | - watch(reactive(root.$frontmatter), (newVal, oldVal) => { |
182 | | - hasKey() |
183 | | - hasPageKey() |
184 | | - }) |
185 | | -
|
186 | | - return { isSidebarOpen, absoluteEncryption, shouldShowNavbar, shouldShowSidebar, pageClasses, isHasKey, hasKey, isHasPageKey, toggleSidebar, firstLoad } |
| 162 | + return { isSidebarOpen, absoluteEncryption, shouldShowNavbar, shouldShowSidebar, pageClasses, hasKey, hasPageKey, isHasKey, isHasPageKey, toggleSidebar, firstLoad } |
187 | 163 | }, |
188 | 164 |
|
189 | 165 | watch: { |
@@ -225,7 +201,7 @@ export default defineComponent({ |
225 | 201 | overflow hidden |
226 | 202 |
|
227 | 203 | .fade-enter-active, .fade-leave-active { |
228 | | - transition: opacity .5s; |
| 204 | + transition: opacity .5s ease-in-out .5s; |
229 | 205 | } |
230 | 206 | .fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ { |
231 | 207 | opacity: 0; |
|
0 commit comments