fix: select customicon error #7377

pull/7519/head
tangjinzhou 2024-04-22 15:26:02 +08:00
parent 752686e334
commit 23c620ea3a
2 changed files with 5 additions and 5 deletions

View File

@ -4,7 +4,7 @@ import type { DefaultOptionType, SingleValueType } from '../Cascader';
import { SEARCH_MARK } from '../hooks/useSearchOptions'; import { SEARCH_MARK } from '../hooks/useSearchOptions';
import type { Key } from '../../_util/type'; import type { Key } from '../../_util/type';
import { useInjectCascader } from '../context'; import { useInjectCascader } from '../context';
import { cloneVNode } from 'vue'; import { cloneElement } from '../../_util/vnode';
export const FIX_LABEL = '__cascader_fix_label__'; export const FIX_LABEL = '__cascader_fix_label__';
export interface ColumnProps { export interface ColumnProps {
prefixCls: string; prefixCls: string;
@ -152,10 +152,10 @@ export default function Column({
)} )}
<div class={`${menuItemPrefixCls}-content`}>{label}</div> <div class={`${menuItemPrefixCls}-content`}>{label}</div>
{!isLoading && expandIcon && !isMergedLeaf && ( {!isLoading && expandIcon && !isMergedLeaf && (
<div class={`${menuItemPrefixCls}-expand-icon`}>{cloneVNode(expandIcon)}</div> <div class={`${menuItemPrefixCls}-expand-icon`}>{cloneElement(expandIcon)}</div>
)} )}
{isLoading && loadingIcon && ( {isLoading && loadingIcon && (
<div class={`${menuItemPrefixCls}-loading-icon`}>{cloneVNode(loadingIcon)}</div> <div class={`${menuItemPrefixCls}-loading-icon`}>{cloneElement(loadingIcon)}</div>
)} )}
</li> </li>
); );

View File

@ -1,4 +1,4 @@
import { cloneVNode } from 'vue'; import { cloneVNode, isVNode } from 'vue';
import type { VNode, FunctionalComponent, PropType } from 'vue'; import type { VNode, FunctionalComponent, PropType } from 'vue';
import type { MouseEventHandler } from '../_util/EventInterface'; import type { MouseEventHandler } from '../_util/EventInterface';
import type { VueNode } from '../_util/type'; import type { VueNode } from '../_util/type';
@ -24,7 +24,7 @@ const TransBtn: TransBtnType = (props, { slots }) => {
if (typeof customizeIcon === 'function') { if (typeof customizeIcon === 'function') {
icon = customizeIcon(customizeIconProps); icon = customizeIcon(customizeIconProps);
} else { } else {
icon = cloneVNode(customizeIcon as VNode); icon = isVNode(customizeIcon) ? cloneVNode(customizeIcon as VNode) : customizeIcon;
} }
return ( return (