From ac9d1b0a7f425f608eab3c3012eb09610376b2cc Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Thu, 19 Sep 2024 19:07:08 +0800 Subject: [PATCH] fix: empty memory issue --- components/empty/index.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/components/empty/index.tsx b/components/empty/index.tsx index 5d73982bc..ab778c9e6 100644 --- a/components/empty/index.tsx +++ b/components/empty/index.tsx @@ -1,4 +1,4 @@ -import { defineComponent } from 'vue'; +import { defineComponent, h } from 'vue'; import type { CSSProperties, ExtractPropTypes } from 'vue'; import classNames from '../_util/classNames'; import LocaleReceiver from '../locale-provider/LocaleReceiver'; @@ -11,9 +11,6 @@ import useConfigInject from '../config-provider/hooks/useConfigInject'; import useStyle from './style'; -const defaultEmptyImg = ; -const simpleEmptyImg = ; - interface Locale { description?: string; } @@ -40,13 +37,16 @@ const Empty = defineComponent({ return () => { const prefixCls = prefixClsRef.value; const { - image = slots.image?.() || defaultEmptyImg, + image: mergedImage = slots.image?.() || h(DefaultEmptyImg), description = slots.description?.() || undefined, imageStyle, class: className = '', ...restProps } = { ...props, ...attrs }; - + const image = + typeof mergedImage === 'function' ? (mergedImage as () => VueNode)() : mergedImage; + const isNormal = + typeof image === 'object' && 'type' in image && (image.type as any).PRESENTED_IMAGE_SIMPLE; return wrapSSR( h(DefaultEmptyImg); +Empty.PRESENTED_IMAGE_SIMPLE = () => h(SimpleEmptyImg); export default withInstall(Empty);