diff --git a/src/tree-select/README.md b/src/tree-select/README.md index 09c7a3f46..3c833a95d 100644 --- a/src/tree-select/README.md +++ b/src/tree-select/README.md @@ -52,7 +52,7 @@ export default { | Attribute | Description | Type | Default | |------|------|------|------| | items | Required datasets for the component | `Item[]` | `[]` | -| height | Height (px) | `number` | `300` | +| height | Height | `string | number` | `300` | | main-Active-index | The index of selected parent node | `number` | `0` | | active-id | Id of selected item | `string | number` | `0` | diff --git a/src/tree-select/README.zh-CN.md b/src/tree-select/README.zh-CN.md index 310a31e0b..7b7bfd020 100644 --- a/src/tree-select/README.zh-CN.md +++ b/src/tree-select/README.zh-CN.md @@ -52,7 +52,7 @@ export default { | 参数 | 说明 | 类型 | 默认值 | 版本 | |------|------|------|------|------| | items | 分类显示所需的数据 | `Item[]` | `[]` | - | -| height | 高度,单位为 px | `number` | `300` | - | +| height | 高度,默认单位为 px | `string | number` | `300` | - | | main-active-index | 左侧导航高亮的索引 | `number` | `0` | - | | active-id | 右侧选择项,高亮的数据id | `string | number` | `0` | - | diff --git a/src/tree-select/index.tsx b/src/tree-select/index.tsx index 8862b17be..918f8402b 100644 --- a/src/tree-select/index.tsx +++ b/src/tree-select/index.tsx @@ -1,4 +1,4 @@ -import { createNamespace } from '../utils'; +import { createNamespace, addUnit } from '../utils'; import { emit, inherit } from '../utils/functional'; import Icon from '../icon'; @@ -19,7 +19,7 @@ export type TreeSelectChildren = { }; export type TreeSelectProps = { - height: number; + height: number | string; items: TreeSelectItem[]; activeId: number | string; mainActiveIndex: number; @@ -98,7 +98,7 @@ function TreeSelect( } return ( -