Commit b3af8f85 authored by jim's avatar jim

fix #821 Menu selection problem

parent 5c21b990
......@@ -20,3 +20,4 @@ yarn.lock
package-lock.json
*bak
jsconfig.json
.prettierrc
......@@ -87,12 +87,12 @@ export default class SiderMenu extends PureComponent {
}
/**
* Get selected child nodes
* /user/chen => /user/:id
* /user/chen => ['user','/user/:id']
*/
getSelectedMenuKeys = (path) => {
const flatMenuKeys = this.getFlatMenuKeys(this.menus);
return flatMenuKeys.filter((item) => {
return pathToRegexp(`/${item}`).test(path);
return pathToRegexp(`/${item}(.*)`).test(path);
});
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment