diff --git a/src/_common b/src/_common index fdf8357788..4bdf9ced2d 160000 --- a/src/_common +++ b/src/_common @@ -1 +1 @@ -Subproject commit fdf83577887894362b0cc792149a5e4d30b968e8 +Subproject commit 4bdf9ced2d0b1c3aaf88c035424ef2230d71f396 diff --git a/src/space/_example/combination.vue b/src/space/_example/combination.vue new file mode 100644 index 0000000000..9ea599bac2 --- /dev/null +++ b/src/space/_example/combination.vue @@ -0,0 +1,18 @@ + diff --git a/src/space/space.tsx b/src/space/space.tsx index c7dcd2c951..c7c7836a4a 100644 --- a/src/space/space.tsx +++ b/src/space/space.tsx @@ -1,4 +1,4 @@ -import { defineComponent, computed, CSSProperties, Fragment } from 'vue'; +import { defineComponent, computed, CSSProperties, Fragment, Comment, isVNode } from 'vue'; import props from './props'; import { usePrefixClass } from '../hooks/useConfig'; import { useTNodeJSX } from '../hooks/tnode'; @@ -57,16 +57,18 @@ export default defineComponent({ function renderChildren() { const children = getChildSlots(); const separatorContent = renderTNodeJSX('separator'); - return children.map((child, index) => { - // filter last child - const showSeparator = index + 1 !== children.length && separatorContent; - return ( - -
{child}
- {showSeparator &&
{separatorContent}
} -
- ); - }); + return children + .filter((child) => (isVNode(child) ? child.type !== Comment : true)) + .map((child, index) => { + // filter last child + const showSeparator = index + 1 !== children.length && separatorContent; + return ( + +
{child}
+ {showSeparator &&
{separatorContent}
} +
+ ); + }); } return () => {