@@ -161,7 +161,7 @@ export default {
161
161
searchedOptions () {
162
162
const results = []
163
163
164
- this .sidebars .forEach (item => {
164
+ this .sidebars .forEach (( item ) => {
165
165
if (item .to ) {
166
166
results .push ({
167
167
to: item .to ,
@@ -170,7 +170,7 @@ export default {
170
170
}
171
171
172
172
if (item .headers ) {
173
- item .headers .forEach (header => {
173
+ item .headers .forEach (( header ) => {
174
174
results .push ({
175
175
to: ` ${ item .to } #${ header .slug } ` ,
176
176
text: header .title ,
@@ -179,14 +179,14 @@ export default {
179
179
}
180
180
181
181
if (item .children ) {
182
- item .children .forEach (child => {
182
+ item .children .forEach (( child ) => {
183
183
results .push ({
184
184
to: child .to ,
185
185
text: child .title ,
186
186
})
187
187
188
188
if (child .headers ) {
189
- child .headers .forEach (h => {
189
+ child .headers .forEach (( h ) => {
190
190
results .push ({
191
191
to: ` ${ child .to } #${ h .slug } ` ,
192
192
text: h .title ,
@@ -197,7 +197,7 @@ export default {
197
197
}
198
198
})
199
199
200
- return results .filter (item =>
200
+ return results .filter (( item ) =>
201
201
(item .text || ' ' )
202
202
.toLowerCase ()
203
203
.includes (this .searchKeyword .toLowerCase ())
@@ -218,7 +218,7 @@ export default {
218
218
return decodeURIComponent (this .$route .fullPath )
219
219
},
220
220
localePathList () {
221
- return Object .keys (this .$site .locales || {}).map (locale => {
221
+ return Object .keys (this .$site .locales || {}).map (( locale ) => {
222
222
const item = this .$site .locales [locale]
223
223
const languageTitle =
224
224
config .get (this .$site , ' label' , locale) || item .text || item .lang
@@ -230,7 +230,7 @@ export default {
230
230
} else {
231
231
path = this .$page .path .replace (this .$localePath , item .path ) // Try to stay on the same page
232
232
233
- const notFound = ! this .$site .pages .some (page => page .path === path)
233
+ const notFound = ! this .$site .pages .some (( page ) => page .path === path)
234
234
235
235
if (notFound) {
236
236
path = item .path // Fallback to homepage
@@ -251,7 +251,7 @@ export default {
251
251
)
252
252
253
253
const order = groupOrderConfig
254
- ? groupOrderConfig .filter (item => !! this .items [item])
254
+ ? groupOrderConfig .filter (( item ) => !! this .items [item])
255
255
: Object .keys (this .items )
256
256
257
257
const index = order .indexOf (' home' )
@@ -267,10 +267,10 @@ export default {
267
267
},
268
268
sidebars () {
269
269
return this .sidebarGroupOrder
270
- .map (item => {
270
+ .map (( item ) => {
271
271
return this .items [item]
272
272
})
273
- .filter (item => item)
273
+ .filter (( item ) => item)
274
274
},
275
275
},
276
276
mounted () {
@@ -294,6 +294,10 @@ export default {
294
294
this .containerWidth = width ? ` ${ width} px` : ' 100%'
295
295
},
296
296
savePosition () {
297
+ if (! this .$refs .container ) {
298
+ return
299
+ }
300
+
297
301
const top = this .$refs .container .scrollTop
298
302
299
303
window .localStorage .setItem (' vuepress_theme_api_sidebar_position' , top)
0 commit comments