feat(TreeSelect): add max prop (#4323)

This commit is contained in:
neverland
2019-09-02 16:54:48 +08:00
committed by GitHub
parent 9adf00b8a1
commit 8eab7b41b5
4 changed files with 40 additions and 3 deletions
+6 -1
View File
@@ -21,6 +21,7 @@ export type TreeSelectChildren = {
export type TreeSelectActiveId = number | string | (number | string)[];
export type TreeSelectProps = {
max: number;
height: number | string;
items: TreeSelectItem[];
activeId: TreeSelectActiveId;
@@ -100,7 +101,7 @@ function TreeSelect(
if (index !== -1) {
newActiveId.splice(index, 1);
} else {
} else if (newActiveId.length < props.max) {
newActiveId.push(item.id);
}
}
@@ -130,6 +131,10 @@ function TreeSelect(
}
TreeSelect.props = {
max: {
type: Number,
default: Infinity
},
items: {
type: Array,
default: () => []