feat(TreeSelect): some props can be string

This commit is contained in:
陈嘉涵
2020-01-31 10:20:36 +08:00
parent 5e658b08ce
commit e2f1e6810b
3 changed files with 11 additions and 11 deletions
+5 -5
View File
@@ -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,
},
};