|
@@ -10,19 +10,19 @@ export default (props) => {
|
10
|
10
|
const navigate = useNavigate();
|
11
|
11
|
const { meta } = useRoute() || {};
|
12
|
12
|
|
13
|
|
- // const selectedKeys = React.useMemo(() => {
|
14
|
|
- // const parts = location.pathname.split('/').filter(Boolean);
|
15
|
|
- // const keys = parts.reduce((acc, it) => {
|
16
|
|
- // const parent = acc.pop();
|
17
|
|
- // const path = !parent ? `/${it}` : `${parent}/${it}`
|
|
13
|
+ const selectedKeys = React.useMemo(() => {
|
|
14
|
+ const parts = location.pathname.split('/').filter(Boolean);
|
|
15
|
+ const keys = parts.reduce((acc, it) => {
|
|
16
|
+ const parent = acc.pop();
|
|
17
|
+ const path = !parent ? `/${it}` : `${parent}/${it}`
|
18
|
18
|
|
19
|
|
- // return acc.concat([parent, path].filter(Boolean));
|
20
|
|
- // }, []);
|
|
19
|
+ return acc.concat([parent, path].filter(Boolean));
|
|
20
|
+ }, []);
|
21
|
21
|
|
22
|
|
- // return keys;
|
23
|
|
- // }, [location.pathname]);
|
|
22
|
+ return keys;
|
|
23
|
+ }, [location.pathname]);
|
24
|
24
|
|
25
|
|
- const selectedKeys = [location.pathname];
|
|
25
|
+ // const selectedKeys = [location.pathname];
|
26
|
26
|
|
27
|
27
|
const onClick = ({key}) => {
|
28
|
28
|
const path = key
|