以下是一个示例代码:
import React, { useState } from 'react';
import { Modal, Button } from 'antd';
function MyComponent() {
const [visible, setVisible] = useState(false);
const showModal = () => {
setVisible(true);
};
const handleOk = () => {
setVisible(false);
};
const handleCancel = () => {
setVisible(false);
};
return (
<>
这是模态框的内容
>
);
}