ant-design/components/drawer/demo/scroll-debug.md
二货爱吃白萝卜 f4859202f5
fix: Nest Drawer default open show order (#37767)
* chore: bump drawer

* docs: Drawer test demo

* test: Update snapshot

* docs: Update demo

* chore: fix nest style

* chore: trigger CI

* chore: modify bundle size
2022-09-29 00:05:37 +08:00

1.8 KiB

order title debug
999
zh-CN en-US
滚动锁定调试 Scroll Debug
true

zh-CN

当 Modal 和 Drawer 共同作用时的滚动锁定调试。

en-US

Scroll lock debug with Modal & Drawer.

import { Switch, Space, Drawer, Modal } from 'antd';
import React, { useState } from 'react';

const App: React.FC = () => {
  const [drawer, setDrawer] = useState(false);
  const [drawer2, setDrawer2] = useState(false);
  const [modal, setModal] = useState(false);
  const [modal2, setModal2] = useState(false);

  return (
    <div style={{ position: 'relative', zIndex: 999999 }}>
      <Space>
        <Switch
          checkedChildren="Drawer"
          unCheckedChildren="Drawer"
          checked={drawer}
          onChange={() => setDrawer(!drawer)}
        />
        <Switch
          checkedChildren="Drawer2"
          unCheckedChildren="Drawer2"
          checked={drawer2}
          onChange={() => setDrawer2(!drawer2)}
        />
        <Switch
          checkedChildren="Modal"
          unCheckedChildren="Modal"
          checked={modal}
          onChange={() => setModal(!modal)}
        />
        <Switch
          checkedChildren="Modal2"
          unCheckedChildren="Modal2"
          checked={modal2}
          onChange={() => setModal2(!modal2)}
        />
      </Space>
      <Drawer title="Drawer" open={drawer}>
        Some contents...
        <Drawer title="Drawer Sub" open={drawer}>
          Sub contents...
        </Drawer>
      </Drawer>
      <Drawer title="Drawer2" open={drawer2}>
        Some contents...
      </Drawer>
      <Modal title="Modal" open={modal}>
        Some contents...
      </Modal>
      <Modal title="Modal2" open={modal2}>
        Some contents...
      </Modal>
    </div>
  );
};

export default App;