index.tsx 911 B

12345678910111213141516171819202122232425
  1. import Menu from "@/components/Menu"
  2. import Guards from "@/components/Navigation"
  3. import { iMenuItem, RouteModel } from "@/types/router"
  4. import { combinationPath } from "@/utils/util"
  5. import React from 'react'
  6. import { Switch } from 'react-router-dom'
  7. import styles from './index.module.scss'
  8. export default function NavSide(props: any) {
  9. const { routeConfig, match } = props
  10. const menuList: iMenuItem[] = routeConfig?.filter((item: RouteModel) => item.meta).map((item: RouteModel) => {
  11. return { path: combinationPath(match.path, item.path), ...item.meta }
  12. })
  13. return (
  14. <div className="pi-flex-row pi-height-100P">
  15. <Menu list={menuList}></Menu>
  16. <div className={[ 'pi-flex-row', 'pi-height-100P', styles.layout ].join(' ')}>
  17. <Switch>
  18. <Guards routeConfig={routeConfig} match={match}></Guards>
  19. </Switch>
  20. </div>
  21. </div>
  22. )
  23. }