当 MUI 模式处于活动状态时启用滚动 React
我有一个非常简单的组件,使用MUI模态
const Contact = ({ open, handleClose }) => {
return (
<div>
<Modal
aria-labelledby="transition-modal-title"
aria-describedby="transition-modal-description"
open={open}
onClose={handleClose}
closeAfterTransition
BackdropComponent={Backdrop}
BackdropProps={{
timeout: 500,
}}
>
<Fade in={open}>
<Box sx={contactModalStyle}>
<div className='Contact'>
<h2>contact today</h2>
</div>
</Box>
</Fade>
</Modal>
</div>
);
}
export default Contact;
当模态处于活动状态时,默认情况下,该页面的滚动被禁用,MUI是否提供任何道具来启用模态活动时滚动页面滚动?假设页面具有在模态处于活动状态时继续垂直滚动所需的高度尺寸
I have quite a simple component using MUI Modal
const Contact = ({ open, handleClose }) => {
return (
<div>
<Modal
aria-labelledby="transition-modal-title"
aria-describedby="transition-modal-description"
open={open}
onClose={handleClose}
closeAfterTransition
BackdropComponent={Backdrop}
BackdropProps={{
timeout: 500,
}}
>
<Fade in={open}>
<Box sx={contactModalStyle}>
<div className='Contact'>
<h2>contact today</h2>
</div>
</Box>
</Fade>
</Modal>
</div>
);
}
export default Contact;
When the modal is active the scrolling of the page is disabled by default, does MUI provide any props to enable scrolling of the page while the Modal is active? Assuming the page has the height dimensions required to continue scrolling vertically while the modal is active
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以启用
disablesCrolllock
模态演示<
a href =“ https://codesandbox.io/s/basicmodal-material-material-material-demo-demo-demo-forked-nofkw5?fontsize = 14&hidenavigation = 14&hidenavigation=1 = dark“ rel =“ nofollow noreferrer”>
You could enable
disableScrollLock
prop of the modalDemo