123456789101112131415161718192021222324252627282930313233343536 |
- import React from 'react'
- import { Menu } from 'antd'
-
- const menuStyle = { height: '100%' }
-
- export default (props) => {
- const { theme, items, location } = props
-
- // const selectedKeys = React.useMemo(() => {
- // const parts = location.pathname.split('/').filter(Boolean);
- // const keys = parts.reduce((acc, it) => {
- // const parent = acc.pop();
- // const path = !parent ? `/${it}` : `${parent}/${it}`
-
- // return acc.concat([parent, path].filter(Boolean));
- // }, []);
-
- // return keys;
- // }, [location.pathname]);
-
- // const handClick = (e) => {
- // console.log('e', e)
- // navigate(`${e.key}`)
- // }
- const selectedKeys = [location.pathname]
- return (
- <Menu
- // onClick={handClick}
- mode="inline"
- style={menuStyle}
- theme={theme}
- items={items}
- selectedKeys={selectedKeys}
- />
- )
- }
|