Skip to content

Commit 23c620e

Browse files
committed
fix: select customicon error #7377
1 parent 752686e commit 23c620e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

components/vc-cascader/OptionList/Column.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { DefaultOptionType, SingleValueType } from '../Cascader';
44
import { SEARCH_MARK } from '../hooks/useSearchOptions';
55
import type { Key } from '../../_util/type';
66
import { useInjectCascader } from '../context';
7-
import { cloneVNode } from 'vue';
7+
import { cloneElement } from '../../_util/vnode';
88
export const FIX_LABEL = '__cascader_fix_label__';
99
export interface ColumnProps {
1010
prefixCls: string;
@@ -152,10 +152,10 @@ export default function Column({
152152
)}
153153
<div class={`${menuItemPrefixCls}-content`}>{label}</div>
154154
{!isLoading && expandIcon && !isMergedLeaf && (
155-
<div class={`${menuItemPrefixCls}-expand-icon`}>{cloneVNode(expandIcon)}</div>
155+
<div class={`${menuItemPrefixCls}-expand-icon`}>{cloneElement(expandIcon)}</div>
156156
)}
157157
{isLoading && loadingIcon && (
158-
<div class={`${menuItemPrefixCls}-loading-icon`}>{cloneVNode(loadingIcon)}</div>
158+
<div class={`${menuItemPrefixCls}-loading-icon`}>{cloneElement(loadingIcon)}</div>
159159
)}
160160
</li>
161161
);

components/vc-select/TransBtn.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { cloneVNode } from 'vue';
1+
import { cloneVNode, isVNode } from 'vue';
22
import type { VNode, FunctionalComponent, PropType } from 'vue';
33
import type { MouseEventHandler } from '../_util/EventInterface';
44
import type { VueNode } from '../_util/type';
@@ -24,7 +24,7 @@ const TransBtn: TransBtnType = (props, { slots }) => {
2424
if (typeof customizeIcon === 'function') {
2525
icon = customizeIcon(customizeIconProps);
2626
} else {
27-
icon = cloneVNode(customizeIcon as VNode);
27+
icon = isVNode(customizeIcon) ? cloneVNode(customizeIcon as VNode) : customizeIcon;
2828
}
2929

3030
return (

0 commit comments

Comments
 (0)