问题:react antd多层抽屉使用getContainer={false},内层抽屉打开后,抽屉不在停靠在窗口的最边上,如下图所示:
解决办法:
指定内外层抽屉挂载的节点为外层抽屉的父容器。即设置getContainer={() => document.getElementById('parent-container')}
<div className={styles.main} id="parent-container">
……
<Drawer
getContainer={() => document.getElementById('parent-container')}
……
/>
……
</div>
如果上述添加完成后,发现内层抽屉位于外层抽屉的下一层,给内层Drawer添加zIndex={1001},由于zIndex默认值为1000,内层抽屉的zIndex大于1000即可。