diff --git a/components/_util/props-util/index.js b/components/_util/props-util/index.js index 86eb35642c..1004d47f8e 100644 --- a/components/_util/props-util/index.js +++ b/components/_util/props-util/index.js @@ -341,6 +341,10 @@ export function isEmptyElement(c) { ); } +export function isEmptySlot(c) { + return !c || c().every(isEmptyElement); +} + export function isStringElement(c) { return c && c.type === Text; } diff --git a/components/date-picker/createPicker.tsx b/components/date-picker/createPicker.tsx index 0a31752236..3d317416e4 100644 --- a/components/date-picker/createPicker.tsx +++ b/components/date-picker/createPicker.tsx @@ -14,6 +14,7 @@ import { hasProp, getOptionProps, getComponent, isValidElement } from '../_util/ import { cloneElement } from '../_util/vnode'; import { formatDate } from './utils'; import { getDataAndAriaProps } from '../_util/util'; +import { isEmptySlot } from '../_util/props-util'; export interface PickerProps { value?: moment.Moment; @@ -255,7 +256,7 @@ export default function createPicker
(
>