前端: 添加右键菜单组件
This commit is contained in:
parent
bfd5d30a42
commit
51acd4294a
35
frontend/src/renderer/components/RightClickMenu.jsx
Normal file
35
frontend/src/renderer/components/RightClickMenu.jsx
Normal file
@ -0,0 +1,35 @@
|
||||
import React from 'react';
|
||||
import { Menu, Modal } from 'antd';
|
||||
|
||||
function RightClickMenu({ visible, position, onClose, onAction }) {
|
||||
const menuItems = [
|
||||
{ key: 'open', label: '打开' },
|
||||
{ key: 'download', label: '下载' },
|
||||
{ key: 'share', label: '分享' },
|
||||
{ key: 'rename', label: '重命名' },
|
||||
{ key: 'copy', label: '复制' },
|
||||
{ key: 'move', label: '移动' },
|
||||
{ type: 'divider' },
|
||||
{ key: 'delete', label: '删除', danger: true },
|
||||
];
|
||||
|
||||
return (
|
||||
<Menu
|
||||
style={{
|
||||
display: visible ? 'block' : 'none',
|
||||
position: 'fixed',
|
||||
left: position?.x || 0,
|
||||
top: position?.y || 0,
|
||||
zIndex: 1000,
|
||||
boxShadow: '0 2px 8px rgba(0,0,0,0.15)',
|
||||
}}
|
||||
items={menuItems}
|
||||
onClick={({ key }) => {
|
||||
onAction?.(key);
|
||||
onClose?.();
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export;
|
||||
Loading…
Reference in New Issue
Block a user