Skip to content

Commit

Permalink
chore: demo improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
aojunhao123 committed Nov 11, 2024
1 parent 182add5 commit ac9010c
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion examples/mutiple-with-maxCount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import TreeSelect from '../src';

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

const treeData = [
{
Expand All @@ -15,6 +16,11 @@ export default () => {
value: '1-1',
title: '1-1',
},
{
key: '1-2',
value: '1-2',
title: '1-2',
},
],
},
{
Expand All @@ -38,6 +44,10 @@ export default () => {
setValue(val);
};

const onCheckChange = (val: string[]) => {
setCheckValue(val);
};

return (
<>
<h2>multiple with maxCount</h2>
Expand All @@ -48,12 +58,23 @@ export default () => {
style={{ width: 300 }}
multiple
treeCheckable
treeCheckStrictly
maxCount={3}
treeData={treeData}
onChange={onChange}
value={value}
/>

<h2>checkable with maxCount and treeCheckStrictly</h2>
<TreeSelect
style={{ width: 300 }}
multiple
treeCheckable
treeCheckStrictly
maxCount={3}
treeData={treeData}
onChange={onCheckChange}
value={checkValue}
/>
</>
);
};

0 comments on commit ac9010c

Please sign in to comment.