Skip to content

Commit e4f678f

Browse files
committed
feat: add skipFlatten
1 parent f00b953 commit e4f678f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

components/_util/props-util/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ const flattenChildren = (children = [], filterEmpty = true) => {
7878
if (Array.isArray(child)) {
7979
res.push(...flattenChildren(child, filterEmpty));
8080
} else if (child && child.type === Fragment) {
81-
res.push(...flattenChildren(child.children, filterEmpty));
81+
if (child.props && child.props.skipFlatten) {
82+
res.push(child);
83+
} else {
84+
res.push(...flattenChildren(child.children, filterEmpty));
85+
}
8286
} else if (child && isVNode(child)) {
8387
if (filterEmpty && !isEmptyElement(child)) {
8488
res.push(child);

components/vc-dropdown/Dropdown.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { CSSProperties, PropType } from 'vue';
2-
import { computed, defineComponent, ref, watch } from 'vue';
2+
import { Fragment, computed, defineComponent, ref, watch } from 'vue';
33
import PropTypes from '../_util/vue-types';
44
import Trigger from '../vc-trigger';
55
import placements from './placements';
@@ -72,10 +72,10 @@ export default defineComponent({
7272
getPopupContainer: () => triggerRef.value.getPopupDomNode(),
7373
};
7474
return (
75-
<>
75+
<Fragment skipFlatten>
7676
{props.arrow && <div class={`${props.prefixCls}-arrow`} />}
7777
{cloneElement(overlayElement, extraOverlayProps, false)}
78-
</>
78+
</Fragment>
7979
);
8080
};
8181

0 commit comments

Comments
 (0)