ConfirmBnt.tsx
879 Bytes
import React from 'react';
import { Button, Popconfirm } from 'antd';
interface Props {
disable: boolean
onCancel: () => any
onOk: () => any
onEdit: () => any
}
export default function Index({disable = false, onCancel = () => null, onOk = () => null, onEdit = () => null}: Props) {
return (
<span style={{display: 'flex', justifyContent: 'center', marginTop: 30, fontSize: 30, marginBottom: 30}}>
{disable ? (
<>
<Popconfirm
placement="top"
title="请确认数据是否填写正确!"
onConfirm={onOk}
onCancel={onCancel}
>
<Button style={{marginRight: 30 }} type="primary">保存</Button>
</Popconfirm>
<Button onClick={onCancel}>取消</Button>
</>
) : (<Button type="primary" onClick={onEdit}>编辑</Button>)}
</span>
);
}