@@ -3,7 +3,8 @@ import React from 'react';
3
3
import Select , { Option } from 'rc-select' ;
4
4
import '../../assets/index.less' ;
5
5
6
- const children = [ ] ;
6
+ const children : React . ReactNode [ ] = [ ] ;
7
+
7
8
for ( let i = 10 ; i < 36 ; i += 1 ) {
8
9
children . push (
9
10
< Option key = { i . toString ( 36 ) + i } disabled = { i === 10 } title = { `中文${ i } ` } >
@@ -18,7 +19,7 @@ class Test extends React.Component {
18
19
suffixIcon : null ,
19
20
loading : false ,
20
21
value : [ 'a10' ] ,
21
- searchValue : "" ,
22
+ searchValue : '' ,
22
23
} ;
23
24
24
25
onChange = ( value , options ) => {
@@ -36,29 +37,29 @@ class Test extends React.Component {
36
37
console . log ( args ) ;
37
38
} ;
38
39
39
- useAnim = e => {
40
+ useAnim = ( e ) => {
40
41
this . setState ( {
41
42
useAnim : e . target . checked ,
42
43
} ) ;
43
44
} ;
44
45
45
- showArrow = e => {
46
+ showArrow = ( e ) => {
46
47
this . setState ( {
47
48
suffixIcon : e . target . checked ? < div > arrow</ div > : null ,
48
49
} ) ;
49
50
} ;
50
51
51
- loading = e => {
52
+ loading = ( e ) => {
52
53
this . setState ( {
53
54
loading : e . target . checked ,
54
55
} ) ;
55
56
} ;
56
57
57
- setSearchValue = val => {
58
+ setSearchValue = ( val ) => {
58
59
this . setState ( {
59
60
searchValue : val ,
60
- } )
61
- }
61
+ } ) ;
62
+ } ;
62
63
63
64
render ( ) {
64
65
const { useAnim, loading, value, suffixIcon } = this . state ;
@@ -74,7 +75,12 @@ class Test extends React.Component {
74
75
< p />
75
76
< label htmlFor = "showArrow" >
76
77
showArrow
77
- < input id = "showArrow" checked = { ! ! suffixIcon } type = "checkbox" onChange = { this . showArrow } />
78
+ < input
79
+ id = "showArrow"
80
+ checked = { ! ! suffixIcon }
81
+ type = "checkbox"
82
+ onChange = { this . showArrow }
83
+ />
78
84
</ label >
79
85
</ p >
80
86
< p >
@@ -102,33 +108,32 @@ class Test extends React.Component {
102
108
placeholder = "please select"
103
109
onChange = { this . onChange }
104
110
onFocus = { ( ) => console . log ( 'focus' ) }
105
- onBlur = { v => console . log ( 'blur' , v ) }
111
+ onBlur = { ( v ) => console . log ( 'blur' , v ) }
106
112
tokenSeparators = { [ ' ' , ',' ] }
107
113
>
108
114
{ children }
109
115
</ Select >
110
116
</ div >
111
117
112
-
113
118
< h2 > multiple select with autoClearSearchValue = false</ h2 >
114
119
< div style = { { width : 300 } } >
115
120
< Select
116
- value = { value }
117
- style = { { width : 500 } }
118
- mode = "multiple"
119
- autoClearSearchValue = { false }
120
- showSearch = { true }
121
- searchValue = { this . state . searchValue }
122
- onSearch = { this . setSearchValue }
123
- optionFilterProp = "children"
124
- optionLabelProp = "children"
125
- onSelect = { this . onSelect }
126
- onDeselect = { this . onDeselect }
127
- placeholder = "please select"
128
- onChange = { this . onChange }
129
- onFocus = { ( ) => console . log ( 'focus' ) }
130
- onBlur = { v => console . log ( 'blur' , v ) }
131
- tokenSeparators = { [ ' ' , ',' ] }
121
+ value = { value }
122
+ style = { { width : 500 } }
123
+ mode = "multiple"
124
+ autoClearSearchValue = { false }
125
+ showSearch = { true }
126
+ searchValue = { this . state . searchValue }
127
+ onSearch = { this . setSearchValue }
128
+ optionFilterProp = "children"
129
+ optionLabelProp = "children"
130
+ onSelect = { this . onSelect }
131
+ onDeselect = { this . onDeselect }
132
+ placeholder = "please select"
133
+ onChange = { this . onChange }
134
+ onFocus = { ( ) => console . log ( 'focus' ) }
135
+ onBlur = { ( v ) => console . log ( 'blur' , v ) }
136
+ tokenSeparators = { [ ' ' , ',' ] }
132
137
>
133
138
{ children }
134
139
</ Select >
0 commit comments