Cmen
3 years ago
5 changed files with 74 additions and 5 deletions
@ -0,0 +1,19 @@
|
||||
import MenuGroup from "./MenuGroup"; |
||||
|
||||
const FileMenu = () => { |
||||
const openGeoJSON = () => {}; |
||||
return ( |
||||
<MenuGroup |
||||
{...{ |
||||
name: "文件", |
||||
items: [ |
||||
{ name: "新建", onClick: openGeoJSON }, |
||||
{ name: "打开", onClick: openGeoJSON }, |
||||
{ name: "另存为", onClick: openGeoJSON }, |
||||
], |
||||
}} |
||||
/> |
||||
); |
||||
}; |
||||
|
||||
export default FileMenu; |
@ -0,0 +1,29 @@
|
||||
import { Menu, Dropdown } from "antd"; |
||||
|
||||
export type MenuItemConfig = { |
||||
name: string; |
||||
onClick: () => void; |
||||
}; |
||||
|
||||
export type MenuConfig = { |
||||
name: string; |
||||
items: MenuItemConfig[]; |
||||
}; |
||||
|
||||
const MenuGroup = (props: MenuConfig) => { |
||||
const menu = ( |
||||
<Menu> |
||||
{props.items.map((item, index) => ( |
||||
<Menu.Item key={index}>{item.name}</Menu.Item> |
||||
))} |
||||
</Menu> |
||||
); |
||||
|
||||
return ( |
||||
<Dropdown overlay={menu} trigger={["click"]}> |
||||
<span className="menu-title">{props.name}</span> |
||||
</Dropdown> |
||||
); |
||||
}; |
||||
|
||||
export default MenuGroup; |
@ -1,5 +1,13 @@
|
||||
import FileMenu from "./File"; |
||||
|
||||
import "./style.less"; |
||||
|
||||
const Menu = () => { |
||||
return <h1>属性区域</h1>; |
||||
return ( |
||||
<> |
||||
<FileMenu /> |
||||
</> |
||||
); |
||||
}; |
||||
|
||||
export default Menu; |
||||
|
Loading…
Reference in new issue