File tree Expand file tree Collapse file tree 1 file changed +29
-9
lines changed Expand file tree Collapse file tree 1 file changed +29
-9
lines changed Original file line number Diff line number Diff line change 1
- import React from 'react' ;
1
+ import React , { useState } from 'react' ;
2
2
import TreeSelect from '../src' ;
3
3
4
4
export default ( ) => {
5
+ const [ value , setValue ] = useState < string [ ] > ( [ '1' ] ) ;
6
+
5
7
const treeData = [
6
8
{
7
9
key : '1' ,
@@ -31,15 +33,33 @@ export default () => {
31
33
title : '4' ,
32
34
} ,
33
35
] ;
34
- const onChange = ( ) => { } ;
36
+
37
+ const onChange = ( value : string [ ] ) => {
38
+ setValue ( value ) ;
39
+ } ;
35
40
36
41
return (
37
- < TreeSelect
38
- style = { { width : 300 } }
39
- multiple
40
- maxCount = { 3 }
41
- treeData = { treeData }
42
- onChange = { onChange }
43
- />
42
+ < >
43
+ < h2 > multiple with maxCount</ h2 >
44
+ < TreeSelect
45
+ style = { { width : 300 } }
46
+ multiple
47
+ maxCount = { 3 }
48
+ treeData = { treeData }
49
+ onChange = { onChange }
50
+ value = { value }
51
+ />
52
+
53
+ < h2 > checkable with maxCount</ h2 >
54
+ < TreeSelect
55
+ style = { { width : 300 } }
56
+ multiple
57
+ treeCheckable
58
+ maxCount = { 3 }
59
+ treeData = { treeData }
60
+ onChange = { onChange }
61
+ value = { value }
62
+ />
63
+ </ >
44
64
) ;
45
65
} ;
You can’t perform that action at this time.
0 commit comments