File tree Expand file tree Collapse file tree 3 files changed +13
-22
lines changed
Expand file tree Collapse file tree 3 files changed +13
-22
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ export default {
137137 return
138138 }
139139
140- this .isHasPageKey = pageKeys && pageKeys .indexOf (sessionStorage .getItem (' pageKey' )) > - 1
140+ this .isHasPageKey = pageKeys && pageKeys .indexOf (sessionStorage .getItem (` pageKey${ window . location . pathname } ` )) > - 1
141141 },
142142 toggleSidebar (to ) {
143143 this .isSidebarOpen = typeof to === ' boolean' ? to : ! this .isSidebarOpen
Original file line number Diff line number Diff line change @@ -144,15 +144,6 @@ export default {
144144
145145 mounted () {
146146 this .recoShow = true
147-
148- const keys = this .$frontmatter .keys
149- if (! keys) {
150- this .isHasKey = true
151- return
152- }
153-
154- this .isHasKey = keys && keys .indexOf (sessionStorage .getItem (' pageKey' )) > - 1
155- this .$parent .isHasPageKey = this .isHasKey
156147 },
157148
158149 methods: {
Original file line number Diff line number Diff line change @@ -52,14 +52,24 @@ export default {
5252 computed: {
5353 year () {
5454 return new Date ().getFullYear ()
55+ },
56+ isHasKey () {
57+ const keyPage = this .$themeConfig .keyPage
58+ const keys = keyPage .keys
59+ return keys && keys .indexOf (sessionStorage .getItem (' key' )) > - 1
60+ },
61+ isHasPageKey () {
62+ const pageKeys = this .$frontmatter .keys
63+
64+ return pageKeys && pageKeys .indexOf (sessionStorage .getItem (` pageKey${ window .location .pathname } ` )) > - 1
5565 }
5666 },
5767 methods: {
5868 inter () {
5969 const keyVal = this .key .trim ()
60- const key = this .isPage ? ' pageKey' : ' key'
70+ const key = this .isPage ? ` pageKey${ window . location . pathname } ` : ' key'
6171 sessionStorage .setItem (key, keyVal)
62- const isHasKey = this .isPage ? this .isHasPageKey () : this .isHasKey ()
72+ const isHasKey = this .isPage ? this .isHasPageKey : this .isHasKey
6373 if (! isHasKey) {
6474 this .warningText = ' Key Error'
6575 return
@@ -73,16 +83,6 @@ export default {
7383 window .location .reload ()
7484 }, 800 )
7585 },
76- isHasKey () {
77- const keyPage = this .$themeConfig .keyPage
78- const keys = keyPage .keys
79- return keys && keys .indexOf (sessionStorage .getItem (' key' )) > - 1
80- },
81- isHasPageKey () {
82- const pageKeys = this .$frontmatter .keys
83-
84- return pageKeys && pageKeys .indexOf (sessionStorage .getItem (' pageKey' )) > - 1
85- },
8686 inputFocus () {
8787 this .warningText = ' Input Your Key'
8888 },
You can’t perform that action at this time.
0 commit comments