From c05c31772a3db32f0a1fd490fda19311286074e1 Mon Sep 17 00:00:00 2001 From: qiang Date: Tue, 7 Feb 2023 10:13:30 +0800 Subject: [PATCH] fix(Space): Text is not defined in SSR (#11549) --- packages/vant/src/space/Space.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/vant/src/space/Space.tsx b/packages/vant/src/space/Space.tsx index d8645e1b7..9a14ae596 100644 --- a/packages/vant/src/space/Space.tsx +++ b/packages/vant/src/space/Space.tsx @@ -1,10 +1,12 @@ import { computed, + Comment, CSSProperties, defineComponent, ExtractPropTypes, Fragment, PropType, + Text, type VNode, } from 'vue'; import { createNamespace } from '../utils'; @@ -47,7 +49,7 @@ function filterEmpty(children: VNode[] = []) { (c) => !( c && - ((typeof Comment !== 'undefined' && c.type === Comment) || + (c.type === Comment || (c.type === Fragment && c.children?.length === 0) || (c.type === Text && (c.children as string).trim() === '')) )