兼容antd Menu

This commit is contained in:
whyour
2022-05-16 01:47:03 +08:00
parent 9dcc547ac7
commit f1a51638a5
5 changed files with 101 additions and 82 deletions
+20 -28
View File
@@ -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()}>