11import { defineComponent } from 'vue' ;
2- import type { CSSProperties , PropType , ExtractPropTypes } from 'vue' ;
2+ import type { CSSProperties , ExtractPropTypes } from 'vue' ;
33import classNames from '../_util/classNames' ;
44import LocaleReceiver from '../locale-provider/LocaleReceiver' ;
55import DefaultEmptyImg from './empty' ;
66import SimpleEmptyImg from './simple' ;
77import { filterEmpty } from '../_util/props-util' ;
8- import PropTypes from '../_util/vue-types ' ;
9- import { withInstall } from '../_util/type' ;
8+ import type { VueNode } from '../_util/type ' ;
9+ import { anyType , objectType , withInstall } from '../_util/type' ;
1010import useConfigInject from '../config-provider/hooks/useConfigInject' ;
1111
1212import useStyle from './style' ;
@@ -20,17 +20,16 @@ interface Locale {
2020
2121export const emptyProps = ( ) => ( {
2222 prefixCls : String ,
23- class : PropTypes . any ,
24- style : [ String , Object ] as PropType < string | CSSProperties > ,
25- imageStyle : Object as PropType < CSSProperties > ,
26- image : PropTypes . any ,
27- description : PropTypes . any ,
23+ imageStyle : objectType < CSSProperties > ( ) ,
24+ image : anyType < VueNode > ( ) ,
25+ description : anyType < VueNode > ( ) ,
2826} ) ;
2927
3028export type EmptyProps = Partial < ExtractPropTypes < ReturnType < typeof emptyProps > > > ;
3129
3230const Empty = defineComponent ( {
3331 name : 'AEmpty' ,
32+ compatConfig : { MODE : 3 } ,
3433 inheritAttrs : false ,
3534 props : emptyProps ( ) ,
3635 setup ( props , { slots = { } , attrs } ) {
@@ -41,7 +40,7 @@ const Empty = defineComponent({
4140 return ( ) => {
4241 const prefixCls = prefixClsRef . value ;
4342 const {
44- image = defaultEmptyImg ,
43+ image = slots . image ?. ( ) || defaultEmptyImg ,
4544 description = slots . description ?.( ) || undefined ,
4645 imageStyle,
4746 class : className = '' ,
@@ -88,12 +87,5 @@ const Empty = defineComponent({
8887
8988Empty . PRESENTED_IMAGE_DEFAULT = defaultEmptyImg ;
9089Empty . PRESENTED_IMAGE_SIMPLE = simpleEmptyImg ;
91- Empty . inheritAttrs = false ;
92- Empty . props = {
93- prefixCls : String ,
94- image : PropTypes . any ,
95- description : PropTypes . any ,
96- imageStyle : { type : Object as PropType < CSSProperties > , default : undefined as CSSProperties } ,
97- } ;
9890
9991export default withInstall ( Empty ) ;
0 commit comments