File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
docs/.vuepress/theme/components Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -64,15 +64,17 @@ export default {
64
64
},
65
65
htmlRouteClass : function () {
66
66
// patch to apply a root class for styling elements
67
+ // any path that isn't a primary nav item will add the route-index class
67
68
const root = document .getElementsByTagName (' html' )[0 ]
68
- const parts = this .$page .path .split (' /' )
69
- const index = [' introduction' , ' how-to' , ' project' , ' community' ]
70
- index .includes (parts[1 ])
71
- ? root .classList .add (' route-index' )
72
- : root .classList .remove (' route-index' )
69
+ const path = this .$page .path
70
+ const navItems = this .$themeConfig .locales [' /' ].nav
71
+ .slice (1 )
72
+ .map (a => a .link )
73
+ navItems .some (i => path .includes (i))
74
+ ? root .classList .remove (' route-index' )
75
+ : root .classList .add (' route-index' )
73
76
}
74
77
},
75
-
76
78
mounted : function () {
77
79
this .smoothScroll ()
78
80
this .htmlRouteClass ()
You can’t perform that action at this time.
0 commit comments