feat(TreeSelect): add selected-icon prop (#6615)

This commit is contained in:
neverland
2020-06-26 21:19:19 +08:00
committed by GitHub
parent c93319a4c0
commit 5486e82b41
5 changed files with 27 additions and 2 deletions
+7 -2
View File
@@ -34,6 +34,7 @@ export type TreeSelectProps = {
height: number | string;
items: TreeSelectItem[];
activeId: TreeSelectActiveId;
selectedIcon: string;
mainActiveIndex: number | string;
};
@@ -49,7 +50,7 @@ function TreeSelect(
slots: TreeSelectSlots,
ctx: RenderContext<TreeSelectProps>
) {
const { height, items, mainActiveIndex, activeId } = props;
const { items, height, activeId, selectedIcon, mainActiveIndex } = props;
const selectedItem: Partial<TreeSelectItem> = items[+mainActiveIndex] || {};
const subItems = selectedItem.children || [];
@@ -110,7 +111,7 @@ function TreeSelect(
>
{item.text}
{isActiveItem(item.id) && (
<Icon name="success" class={bem('selected')} />
<Icon name={selectedIcon} class={bem('selected')} />
)}
</div>
));
@@ -152,6 +153,10 @@ TreeSelect.props = {
type: [Number, String, Array],
default: 0,
},
selectedIcon: {
type: String,
default: 'success',
},
mainActiveIndex: {
type: [Number, String],
default: 0,