|
- /*
- * @Author: 赵伟
- * @Date: 2024-04-15 10:01:29
- * @Description: 自定义 Modal
- */
-
- import { Modal, type ModalProps } from 'antd';
- import classNames from 'classnames';
- import KFModalTitle from './KFModalTitle';
- import './index.less';
-
- export interface KFModalProps extends ModalProps {
- /** 标题图片 */
- image?: string;
- }
-
- /** 自定义 Modal,应用中的业务 Modal 应该使用它进行封装,推荐使用函数的方式打开 */
- function KFModal({
- title,
- image,
- children,
- className,
- centered,
- maskClosable,
- ...rest
- }: KFModalProps) {
- return (
- <Modal
- className={classNames(['kf-modal', className])}
- {...rest}
- centered={centered ?? true}
- maskClosable={maskClosable ?? false}
- title={<KFModalTitle title={title} image={image} />}
- >
- {children}
- </Modal>
- );
- }
-
- export default KFModal;
|