diff --git a/.gitignore b/.gitignore index aa3fce5825a412febff24ef3bf577105b08862ec..409be881a2a8d9807d016c24dabadebda65395c1 100755 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ yarn.lock package-lock.json *bak jsconfig.json +.prettierrc diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index 5ddf6ed983794c79e83f961ea605311211897bff..4811894da1f5d837a2a18307b58f2d81586c5944 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/src/components/SiderMenu/SiderMenu.js @@ -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); }); } /**