[英]Material Ui, MUI, Dialog, ScrollTop
該有的都有
確保 Dialog 中的 div 溢出
<Dialog fullScreen open={open} onClose={handleClose}>
<div ref={ref}
//MOST IMPORTANT
style={{ backgroundColor: 'red', overflowY: 'auto', height: '100%' }}>
**還有一個 onClick **
<Button
autoFocus
color="inherit"
//HERE
onClick={() => {
const div = ref.current;
div.scrollTop = 800;
}}
>GO DOWN
</Button>
這是一個例子https://codesandbox.io/s/fullscreendialog-material-demo-forked-cf8u6?file=/demo.js:2201-2434
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.