@@ -56,6 +56,10 @@ function BasicLayout({
5656 return (
5757 < >
5858 { menus . map ( ( item , index ) => {
59+ const { mdconf, routePath } = item || { }
60+ const { abbrlink } = mdconf || { }
61+ const path = abbrlink ? `/${ abbrlink } ` : routePath
62+ console . log ( 'item123' , item )
5963 // item.path carrys .md here.
6064 return item . children && item . children . length > 0 ? (
6165 < SubMenu key = { index } keyValue = { item . path } title = { item . name } icon = { < Icon type = "folder" size = { 16 } /> } >
@@ -65,7 +69,7 @@ function BasicLayout({
6569 < Menu . Item
6670 key = { index }
6771 icon = { < Icon type = "file" size = { 16 } /> }
68- keyValue = { item . path }
72+ keyValue = { abbrlink ? `/ ${ abbrlink } ` : item . path }
6973 title = {
7074 item &&
7175 item . type === "directory" &&
@@ -76,8 +80,8 @@ function BasicLayout({
7680 </ span >
7781 ) : (
7882 < Link
79- to = { ifProd ? `/${ repo } ${ item . routePath } ` : item . routePath }
80- replace = { pathname . indexOf ( item . routePath ) > - 1 }
83+ to = { ifProd ? `/${ repo } ${ path } ` : path }
84+ replace = { pathname . indexOf ( path ) > - 1 }
8185 >
8286 { item && item . mdconf && item . mdconf . title
8387 ? item . mdconf . title
@@ -111,6 +115,7 @@ function BasicLayout({
111115 } }
112116 selectedKey = { selectedKey }
113117 onSelect = { ( keyValue ) => {
118+ console . log ( 'keyValue' , keyValue )
114119 setSelectedKey ( keyValue )
115120 } }
116121 defaultOpenKeys = { curOpenKeys }
@@ -217,13 +222,16 @@ function BasicLayout({
217222 { /* see https://reacttraining.com/react-router/web/api/Redirect/exact-bool */ }
218223 < Redirect exact from = { ifAddPrefix ? `/${ repo } ` : `/` } to = { ifAddPrefix ? `/${ repo } /README` : `/README` } />
219224 { routeData . map ( ( item ) => {
225+ const { path, mdconf, component } = item
226+ const { abbrlink } = mdconf
227+ const enhancePath = abbrlink ? `/${ abbrlink } ` : path
220228 return (
221229 < Route
222- key = { item . path }
230+ key = { enhancePath }
223231 exact
224- path = { ifAddPrefix ? `/${ repo } ${ item . path } ` : item . path }
232+ path = { ifAddPrefix ? `/${ repo } ${ enhancePath } ` : enhancePath }
225233 render = { ( ) => {
226- const Comp = item . component
234+ const Comp = component
227235 return < Comp { ...item } />
228236 } }
229237 />
@@ -255,7 +263,7 @@ function BasicLayout({
255263 < Footer inlineCollapsed = { inlineCollapsed } />
256264 </ div >
257265 </ div >
258- ) ;
266+ )
259267}
260268
261269export default BasicLayout
0 commit comments