File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ ## base
2
+
3
+ <code src =" ../examples/base.tsx " >
Original file line number Diff line number Diff line change
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 ;
You can’t perform that action at this time.
0 commit comments