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() === '')) )