SiderBar.jsx 530B

12345678910111213141516171819
  1. import React, { useMemo } from 'react'
  2. import { Layout, Spin } from 'antd'
  3. import { getPropertyValue } from '@/utils/css'
  4. import Menus from './Menus'
  5. const { Sider } = Layout
  6. export default (props) => {
  7. const { theme, location, menus } = props
  8. const width = useMemo(() => {
  9. return /\d+/.exec(getPropertyValue('--siderbar-width'))[0] - 0
  10. }, [])
  11. return (
  12. <Sider className="layout-sidebar" theme={theme} collapsible width={width}>
  13. <Menus theme={theme} items={menus} location={location} />
  14. </Sider>
  15. )
  16. }