可以使用以下CSS样式来避免滚动:
.ant-modal-wrap {
position: fixed;
}
.ant-modal-content {
overflow: auto;
max-height: 90vh;
}
代码示例:
import React from 'react';
import { Button, Modal } from 'antd';
import './index.less';
const ModalContent = () => {
const [visible, setVisible] = React.useState(false);
const showModal = () => {
setVisible(true);
};
const hideModal = () => {
setVisible(false);
};
return (
<>
Cancel
,
,
]}
wrapClassName="ant-modal-wrap"
bodyStyle={{ padding: '24px' }}
>
Some contents...
Some contents...
Some contents...
Some contents...
Some contents...
Some contents...
Some contents...
Some contents...
Some contents...
Some contents...
Some contents...
>
);
};
export default ModalContent;