Skip to content

Commit ac9010c

Browse files
committed
chore: demo improvement
1 parent 182add5 commit ac9010c

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

examples/mutiple-with-maxCount.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import TreeSelect from '../src';
33

44
export default () => {
55
const [value, setValue] = useState<string[]>(['1']);
6+
const [checkValue, setCheckValue] = useState<string[]>(['1']);
67

78
const treeData = [
89
{
@@ -15,6 +16,11 @@ export default () => {
1516
value: '1-1',
1617
title: '1-1',
1718
},
19+
{
20+
key: '1-2',
21+
value: '1-2',
22+
title: '1-2',
23+
},
1824
],
1925
},
2026
{
@@ -38,6 +44,10 @@ export default () => {
3844
setValue(val);
3945
};
4046

47+
const onCheckChange = (val: string[]) => {
48+
setCheckValue(val);
49+
};
50+
4151
return (
4252
<>
4353
<h2>multiple with maxCount</h2>
@@ -48,12 +58,23 @@ export default () => {
4858
style={{ width: 300 }}
4959
multiple
5060
treeCheckable
51-
treeCheckStrictly
5261
maxCount={3}
5362
treeData={treeData}
5463
onChange={onChange}
5564
value={value}
5665
/>
66+
67+
<h2>checkable with maxCount and treeCheckStrictly</h2>
68+
<TreeSelect
69+
style={{ width: 300 }}
70+
multiple
71+
treeCheckable
72+
treeCheckStrictly
73+
maxCount={3}
74+
treeData={treeData}
75+
onChange={onCheckChange}
76+
value={checkValue}
77+
/>
5778
</>
5879
);
5980
};

0 commit comments

Comments
 (0)