@@ -15,47 +15,6 @@ export default class Tags extends Component {
15
15
{ text : 'discussion' , id : 4 } ,
16
16
] ,
17
17
} ;
18
-
19
- this . changeExample1 = this . changeExample1 . bind ( this ) ;
20
- this . changeExample2 = this . changeExample2 . bind ( this ) ;
21
- this . changeExample6 = this . changeExample6 . bind ( this ) ;
22
- }
23
-
24
- changeExample1 ( ) {
25
- this . setState ( { value1 : [ 'bug' , 'discussion' ] } ) ;
26
- }
27
-
28
- changeExample2 ( ) {
29
- this . setState ( { value2 : 3 } ) ;
30
- }
31
-
32
- changeExample6 ( ) {
33
- this . setState ( { data6 : [
34
- { text : 'bug_new' , id : 1 } ,
35
- { text : 'feature_new' , id : 2 } ,
36
- { text : 'documents_new' , id : 3 } ,
37
- { text : 'discussion_new' , id : 4 } ,
38
- ] } ) ;
39
- }
40
-
41
- cbOpen ( ) {
42
- console . log ( 'onOpen' ) ;
43
- }
44
-
45
- cbClose ( ) {
46
- console . log ( 'cbClose' ) ;
47
- }
48
-
49
- cbSelect ( ) {
50
- console . log ( 'cbSelect' ) ;
51
- }
52
-
53
- cbChange ( ) {
54
- console . log ( 'cbChange' ) ;
55
- }
56
-
57
- cbUnselect ( ) {
58
- console . log ( 'cbUnselect' ) ;
59
18
}
60
19
61
20
renderBasicUsage ( ) {
@@ -74,7 +33,9 @@ export default class Tags extends Component {
74
33
}
75
34
/>
76
35
—
77
- < button onClick = { this . changeExample1 } > set 'bug' 'discussion' value</ button >
36
+ < button onClick = { ( ) => this . setState ( { value1 : [ 'bug' , 'discussion' ] } ) } >
37
+ set 'bug' 'discussion' value
38
+ </ button >
78
39
</ div >
79
40
) ;
80
41
}
@@ -99,7 +60,9 @@ export default class Tags extends Component {
99
60
} }
100
61
/>
101
62
—
102
- < button onClick = { this . changeExample2 } > set 'documents' value</ button >
63
+ < button onClick = { ( ) => this . setState ( { value2 : 3 } ) } >
64
+ set 'documents' value
65
+ </ button >
103
66
</ div >
104
67
) ;
105
68
}
@@ -111,11 +74,11 @@ export default class Tags extends Component {
111
74
< Select2
112
75
multiple
113
76
data = { [ 'bug' , 'feature' , 'documents' , 'discussion' ] }
114
- onOpen = { this . cbOpen }
115
- onClose = { this . cbClose }
116
- onSelect = { this . cbSelect }
117
- onChange = { this . cbChange }
118
- onUnselect = { this . cbUnselect }
77
+ onOpen = { ( ) => console . log ( 'onOpen' ) }
78
+ onClose = { ( ) => console . log ( 'onClose' ) }
79
+ onSelect = { ( ) => console . log ( 'onSelect' ) }
80
+ onChange = { ( ) => console . log ( 'onChange' ) }
81
+ onUnselect = { ( ) => console . log ( 'onUnselect' ) }
119
82
options = { {
120
83
placeholder : 'search by tags' ,
121
84
}
@@ -180,7 +143,17 @@ export default class Tags extends Component {
180
143
} }
181
144
/>
182
145
—
183
- < button onClick = { this . changeExample6 } > reload data value</ button >
146
+ < button onClick = { ( ) => this . setState ( {
147
+ data6 : [
148
+ { text : 'bug_new' , id : 1 } ,
149
+ { text : 'feature_new' , id : 2 } ,
150
+ { text : 'documents_new' , id : 3 } ,
151
+ { text : 'discussion_new' , id : 4 } ,
152
+ ] ,
153
+ } ) }
154
+ >
155
+ reload data value
156
+ </ button >
184
157
</ div >
185
158
) ;
186
159
}
0 commit comments