简体   繁体   English

material-ui中Drawer组件中container prop的作用

[英]what does container prop do in the Drawer component in material-ui

I am reading the official document of material-ui's Drawer component, and I found a container prop and I do not have an idea where it comes from.我在看material-ui的Drawer组件的官方文档,我发现了一个container prop,但我不知道它是从哪里来的。 It is not mentioned in its API documentation.它没有在其 API 文档中提及。 Is this one of the built-in react component's props?这是内置反应组件的道具之一吗?

Below is a screenshot of the responsive drawer component from material-ui: https://material-ui.com/components/drawers/#responsive-drawer下面是来自 material-ui 的响应式抽屉组件的截图: https://material-ui.com/components/drawers/#responsive-drawer

在此处输入图像描述

That prop is coming from the Modal props because Drawer includes props from Modal when variant="temporary" .该道具来自Modal道具,因为Drawervariant="temporary"时包含来自Modal的道具。

container - HTML element |容器 - HTML 元素 | func功能

An HTML element or function that returns one.一个返回 1 的 HTML 元素或 function。 The container will have the portal children appended to it.该容器将附加门户子项。 By default, it uses the body of the top-level document object, so it's simply document.默认情况下,它使用顶级文档 object 的主体,因此它只是文档。

Modal Props: https://material-ui.com/api/modal/模态道具: https://material-ui.com/api/modal/

Please check here https://github.com/mui-org/material-ui/blob/5cc1d0fc8756534f181d55af02a5a0d65b486603/packages/material-ui/src/Drawer/Drawer.d.ts#L11请在这里查看https://github.com/mui-org/material-ui/blob/5cc1d0fc8756534f181d55af02a5a0d65b486603/packages/material-ui/src/Drawer/Drawer.d.ts#L11

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM