1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import React, { useState } from 'react';
- import { useNavigate, useLocation } from "react-router-dom";
- import { Menu } from 'antd';
-
- const linkTo = url => {
- const a = document.createElement('a');
- a.href = item.key;
- a.target = '_blank';
- a.click();
- }
-
- const menuStyle = { height: '100%' };
-
- export default (props) => {
- const { theme, items, location } = props;
-
-
- const navigate = useNavigate();
-
- const onClick = (item) => {
-
-
- if (item.key.indexOf('http') === 0) {
-
- linkTo(item.key);
- } else {
-
- navigate(item.key);
- }
- }
-
-
-
-
-
-
-
- return (
- <Menu style={menuStyle} theme={theme} items={items} selectedKeys={[location.pathname]} />
- )
- }
|