feat: add skipFlatten
parent
f00b9535d2
commit
e4f678f665
|
@ -78,7 +78,11 @@ const flattenChildren = (children = [], filterEmpty = true) => {
|
|||
if (Array.isArray(child)) {
|
||||
res.push(...flattenChildren(child, filterEmpty));
|
||||
} else if (child && child.type === Fragment) {
|
||||
res.push(...flattenChildren(child.children, filterEmpty));
|
||||
if (child.props && child.props.skipFlatten) {
|
||||
res.push(child);
|
||||
} else {
|
||||
res.push(...flattenChildren(child.children, filterEmpty));
|
||||
}
|
||||
} else if (child && isVNode(child)) {
|
||||
if (filterEmpty && !isEmptyElement(child)) {
|
||||
res.push(child);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { CSSProperties, PropType } from 'vue';
|
||||
import { computed, defineComponent, ref, watch } from 'vue';
|
||||
import { Fragment, computed, defineComponent, ref, watch } from 'vue';
|
||||
import PropTypes from '../_util/vue-types';
|
||||
import Trigger from '../vc-trigger';
|
||||
import placements from './placements';
|
||||
|
@ -72,10 +72,10 @@ export default defineComponent({
|
|||
getPopupContainer: () => triggerRef.value.getPopupDomNode(),
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<Fragment skipFlatten>
|
||||
{props.arrow && <div class={`${props.prefixCls}-arrow`} />}
|
||||
{cloneElement(overlayElement, extraOverlayProps, false)}
|
||||
</>
|
||||
</Fragment>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue