feat(TreeSelect): some props can be string
This commit is contained in:
@@ -29,11 +29,11 @@ export type TreeSelectChildren = {
|
||||
export type TreeSelectActiveId = number | string | (number | string)[];
|
||||
|
||||
export type TreeSelectProps = {
|
||||
max: number;
|
||||
max: number | string;
|
||||
height: number | string;
|
||||
items: TreeSelectItem[];
|
||||
activeId: TreeSelectActiveId;
|
||||
mainActiveIndex: number;
|
||||
mainActiveIndex: number | string;
|
||||
};
|
||||
|
||||
export type TreeSelectSlots = DefaultSlots & {
|
||||
@@ -50,7 +50,7 @@ function TreeSelect(
|
||||
) {
|
||||
const { height, items, mainActiveIndex, activeId } = props;
|
||||
|
||||
const selectedItem: Partial<TreeSelectItem> = items[mainActiveIndex] || {};
|
||||
const selectedItem: Partial<TreeSelectItem> = items[+mainActiveIndex] || {};
|
||||
const subItems = selectedItem.children || [];
|
||||
const isMultiple = Array.isArray(activeId);
|
||||
|
||||
@@ -136,7 +136,7 @@ function TreeSelect(
|
||||
|
||||
TreeSelect.props = {
|
||||
max: {
|
||||
type: Number,
|
||||
type: [Number, String],
|
||||
default: Infinity,
|
||||
},
|
||||
items: {
|
||||
@@ -152,7 +152,7 @@ TreeSelect.props = {
|
||||
default: 0,
|
||||
},
|
||||
mainActiveIndex: {
|
||||
type: Number,
|
||||
type: [Number, String],
|
||||
default: 0,
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user