Browse Source

fix: select customicon error #7377

pull/7519/head
tangjinzhou 7 months ago
parent
commit
23c620ea3a
  1. 6
      components/vc-cascader/OptionList/Column.tsx
  2. 4
      components/vc-select/TransBtn.tsx

6
components/vc-cascader/OptionList/Column.tsx

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

4
components/vc-select/TransBtn.tsx

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

Loading…
Cancel
Save