[new feature] TreeSelect: support string type of height prop (#4107)

This commit is contained in:
neverland
2019-08-13 12:00:50 +08:00
committed by GitHub
parent 7ad5323836
commit 2843352adb
5 changed files with 23 additions and 6 deletions
+4 -4
View File
@@ -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 (
<div class={bem()} style={{ height: `${height}px` }} {...inherit(ctx)}>
<div class={bem()} style={{ height: addUnit(height) }} {...inherit(ctx)}>
<div class={bem('nav')}>{Nav}</div>
<div class={bem('content')}>{Content()}</div>
</div>
@@ -111,7 +111,7 @@ TreeSelect.props = {
default: () => []
},
height: {
type: Number,
type: [Number, String],
default: 300
},
activeId: {