我有一个抽屉组件锚定在底部,但我仍然希望与抽屉上方的页面交互,但我可以单击if,但抽屉关闭了,所以我尝试了变体persistent和permanent,两者都不工作,它们实际上实现了,所以当我单击if时,什么都不会发生。我认为这与上面的间距或填充有关,但如果有人知道如何禁用那,将非常感激。
解决了我的问题,我结束了我们必须做一些高度变化的纸张组件,它似乎工作的方式我想要。您可以用@material-ui/core/styles
目录中的Makestyles
方法重写css。我使用了类属性的例子
// Outside the component
import { makeStyles } from '@material-ui/core/styles';
const useStyles = makeStyles({
drawer: {
css here ...
}
})
// Inside Component
const classes = useStyles() // the make styles returns a function and calling the useStyles returns an object with the css.
// Inside return
<Drawer
anchor="bottom"
classes={{ paper: classes.drawer }}
>
Content...
</Drawer>