@@ -74,14 +74,19 @@ export default {
7474 } ,
7575 updateMenu ( ) {
7676 const routes = this . $route . matched . concat ( )
77-
78- if ( routes . length >= 4 && this . $route . meta . hidden ) {
77+ console . log ( 'updateMenu: routes -> ' , routes )
78+ console . log ( 'this.$route' , this . $route )
79+ console . log ( 'routes.length >= 3' , routes . length >= 3 , this . $route . meta )
80+ const { hidden } = this . $route . meta
81+ console . log ( 'hidden' , hidden )
82+ if ( routes . length >= 3 && hidden ) {
7983 routes . pop ( )
80- this . selectedKeys = [ routes [ 2 ] . path ]
84+ console . log ( 'updateMenu: routes -> ' , routes )
85+ this . selectedKeys = [ routes [ routes . length - 1 ] . path ]
8186 } else {
8287 this . selectedKeys = [ routes . pop ( ) . path ]
8388 }
84-
89+ console . log ( 'this.selectedKeys' , this . selectedKeys )
8590 const openKeys = [ ]
8691 if ( this . mode === 'inline' ) {
8792 routes . forEach ( item => {
@@ -104,6 +109,16 @@ export default {
104109 const tag = target && 'a' || 'router-link'
105110 const props = { to : { name : menu . name } }
106111 const attrs = { href : menu . path , target : menu . meta . target }
112+
113+ if ( menu . children && menu . hideChildrenInMenu ) {
114+ // ζζεθεη εΉΆδΈ ηΆθεζ―θ¦ιθεθεη
115+ // ι½η»εθεε’ε δΈδΈͺ hidden ε±ζ§
116+ // η¨ζ₯η»ε·ζ°ι‘΅ι’ζΆοΌ selectedKeys εζ§εΆη¨
117+ menu . children . forEach ( item => {
118+ item . meta = Object . assign ( item . meta , { hidden : true } )
119+ } )
120+ }
121+
107122 return (
108123 < Item { ...{ key : menu . path } } >
109124 < tag { ...{ props, attrs } } >
0 commit comments