@@ -3,7 +3,8 @@ import React from 'react';
33import Select , { Option } from 'rc-select' ;
44import '../../assets/index.less' ;
55
6- const children = [ ] ;
6+ const children : React . ReactNode [ ] = [ ] ;
7+
78for ( let i = 10 ; i < 36 ; i += 1 ) {
89 children . push (
910 < Option key = { i . toString ( 36 ) + i } disabled = { i === 10 } title = { `中文${ i } ` } >
@@ -18,7 +19,7 @@ class Test extends React.Component {
1819 suffixIcon : null ,
1920 loading : false ,
2021 value : [ 'a10' ] ,
21- searchValue : "" ,
22+ searchValue : '' ,
2223 } ;
2324
2425 onChange = ( value , options ) => {
@@ -36,29 +37,29 @@ class Test extends React.Component {
3637 console . log ( args ) ;
3738 } ;
3839
39- useAnim = e => {
40+ useAnim = ( e ) => {
4041 this . setState ( {
4142 useAnim : e . target . checked ,
4243 } ) ;
4344 } ;
4445
45- showArrow = e => {
46+ showArrow = ( e ) => {
4647 this . setState ( {
4748 suffixIcon : e . target . checked ? < div > arrow</ div > : null ,
4849 } ) ;
4950 } ;
5051
51- loading = e => {
52+ loading = ( e ) => {
5253 this . setState ( {
5354 loading : e . target . checked ,
5455 } ) ;
5556 } ;
5657
57- setSearchValue = val => {
58+ setSearchValue = ( val ) => {
5859 this . setState ( {
5960 searchValue : val ,
60- } )
61- }
61+ } ) ;
62+ } ;
6263
6364 render ( ) {
6465 const { useAnim, loading, value, suffixIcon } = this . state ;
@@ -74,7 +75,12 @@ class Test extends React.Component {
7475 < p />
7576 < label htmlFor = "showArrow" >
7677 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+ />
7884 </ label >
7985 </ p >
8086 < p >
@@ -102,33 +108,32 @@ class Test extends React.Component {
102108 placeholder = "please select"
103109 onChange = { this . onChange }
104110 onFocus = { ( ) => console . log ( 'focus' ) }
105- onBlur = { v => console . log ( 'blur' , v ) }
111+ onBlur = { ( v ) => console . log ( 'blur' , v ) }
106112 tokenSeparators = { [ ' ' , ',' ] }
107113 >
108114 { children }
109115 </ Select >
110116 </ div >
111117
112-
113118 < h2 > multiple select with autoClearSearchValue = false</ h2 >
114119 < div style = { { width : 300 } } >
115120 < 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 = { [ ' ' , ',' ] }
132137 >
133138 { children }
134139 </ Select >
0 commit comments