Skip to content

Commit 948a600

Browse files
committed
feat: init
1 parent dcd19a5 commit 948a600

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

docs/demo/base.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## base
2+
3+
<code src="../examples/base.tsx">

docs/examples/base.tsx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React, { useState } from 'react';
2+
import Drawer from 'rc-drawer';
3+
4+
const Demo = () => {
5+
const [open, setOpen] = useState(false);
6+
const onChange = (bool: boolean) => {
7+
console.log('change: ', bool);
8+
};
9+
const onTouchEnd = () => {
10+
setOpen(false);
11+
};
12+
const onSwitch = () => {
13+
setOpen(c => !c);
14+
};
15+
return (
16+
<div>
17+
<Drawer
18+
onChange={onChange}
19+
open={open}
20+
onClose={onTouchEnd}
21+
handler={false}
22+
level={null}
23+
afterVisibleChange={(c: boolean) => {
24+
console.log('transitionEnd: ', c);
25+
}}
26+
placement="right"
27+
width={400}
28+
>
29+
content
30+
</Drawer>
31+
<div>
32+
<button onClick={onSwitch}>打开</button>
33+
</div>
34+
</div>
35+
);
36+
};
37+
export default Demo;

0 commit comments

Comments
 (0)