mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-18 02:14:32 +08:00
兼容antd Menu
This commit is contained in:
+20
-28
@@ -627,6 +627,24 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => {
|
||||
});
|
||||
};
|
||||
|
||||
const getMenuItems = (record: any) => {
|
||||
return [
|
||||
{ label: '编辑', key: 'edit', icon: <EditOutlined /> },
|
||||
{
|
||||
label: record.isDisabled === 1 ? '启用' : '禁用',
|
||||
key: 'enableOrDisable',
|
||||
icon:
|
||||
record.isDisabled === 1 ? <CheckCircleOutlined /> : <StopOutlined />,
|
||||
},
|
||||
{ label: '删除', key: 'delete', icon: <DeleteOutlined /> },
|
||||
{
|
||||
label: record.isPinned === 1 ? '取消置顶' : '置顶',
|
||||
key: 'pinOrUnPin',
|
||||
icon: record.isPinned === 1 ? <StopOutlined /> : <PushpinOutlined />,
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
const MoreBtn: React.FC<{
|
||||
record: any;
|
||||
index: number;
|
||||
@@ -637,38 +655,12 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => {
|
||||
trigger={['click']}
|
||||
overlay={
|
||||
<Menu
|
||||
items={getMenuItems(record)}
|
||||
onClick={({ key, domEvent }) => {
|
||||
domEvent.stopPropagation();
|
||||
action(key, record, index);
|
||||
}}
|
||||
>
|
||||
<Menu.Item key="edit" icon={<EditOutlined />}>
|
||||
编辑
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
key="enableOrDisable"
|
||||
icon={
|
||||
record.isDisabled === 1 ? (
|
||||
<CheckCircleOutlined />
|
||||
) : (
|
||||
<StopOutlined />
|
||||
)
|
||||
}
|
||||
>
|
||||
{record.isDisabled === 1 ? '启用' : '禁用'}
|
||||
</Menu.Item>
|
||||
<Menu.Item key="delete" icon={<DeleteOutlined />}>
|
||||
删除
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
key="pinOrUnPin"
|
||||
icon={
|
||||
record.isPinned === 1 ? <StopOutlined /> : <PushpinOutlined />
|
||||
}
|
||||
>
|
||||
{record.isPinned === 1 ? '取消置顶' : '置顶'}
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
/>
|
||||
}
|
||||
>
|
||||
<a onClick={(e) => e.stopPropagation()}>
|
||||
|
||||
Reference in New Issue
Block a user