@@ -3,7 +3,7 @@ import { computed, defineComponent, ref } from 'vue';
33import Tooltip from '../tooltip' ;
44import abstractTooltipProps from '../tooltip/abstractTooltipProps' ;
55import PropTypes from '../_util/vue-types' ;
6- import { initDefaultProps } from '../_util/props-util' ;
6+ import { filterEmpty , initDefaultProps } from '../_util/props-util' ;
77import { withInstall } from '../_util/type' ;
88import useConfigInject from '../_util/hooks/useConfigInject' ;
99import omit from '../_util/omit' ;
@@ -39,10 +39,14 @@ const Popover = defineComponent({
3939 const { prefixCls, configProvider } = useConfigInject ( 'popover' , props ) ;
4040 const rootPrefixCls = computed ( ( ) => configProvider . getPrefixCls ( ) ) ;
4141 const getOverlay = ( ) => {
42- const { title = slots . title ?.( ) , content = slots . content ?.( ) } = props ;
42+ const { title = filterEmpty ( slots . title ?.( ) ) , content = filterEmpty ( slots . content ?.( ) ) } =
43+ props ;
44+ const hasTitle = ! ! ( Array . isArray ( title ) ? title . length : title ) ;
45+ const hasContent = ! ! ( Array . isArray ( content ) ? content . length : title ) ;
46+ if ( ! hasTitle && ! hasContent ) return undefined ;
4347 return (
4448 < >
45- { title && < div class = { `${ prefixCls . value } -title` } > { title } </ div > }
49+ { hasTitle && < div class = { `${ prefixCls . value } -title` } > { title } </ div > }
4650 < div class = { `${ prefixCls . value } -inner-content` } > { content } </ div >
4751 </ >
4852 ) ;
0 commit comments