import {defineComponent, getCurrentInstance} from 'vue'; import {getComponentFromProp} from '../_util/props-util'; import PropTypes from '../_util/vue-types'; import Base from '../base'; import {ConfigConsumerProps} from '../config-provider'; import locale from '../locale-provider/default'; import DefaultEmptyImg from './empty'; import SimpleEmptyImg from './simple'; export const EmptyProps = () => { return { prefixCls: PropTypes.string, image: PropTypes.any, description: PropTypes.any, imageStyle: PropTypes.object }; }; const Empty = defineComponent({ name: 'AEmpty', inheritAttrs: false, props: { ...EmptyProps() }, render(ctx) { const componentInstance = getCurrentInstance(); const {prefixCls: customizePrefixCls, imageStyle} = ctx; const prefixCls = ConfigConsumerProps.getPrefixCls('empty', customizePrefixCls); const image = getComponentFromProp(componentInstance, 'image') || ; const description = getComponentFromProp(componentInstance, 'description'); const des = typeof description === 'undefined' ? locale.Empty.description : description; const alt = typeof des === 'string' ? des : 'empty'; const cls = {[prefixCls]: true}; let imageNode = null; if (typeof image === 'string') { imageNode = {alt}; } else if (typeof image === 'object' && image.PRESENTED_IMAGE_SIMPLE) { const Image = image; imageNode = ; cls[`${prefixCls}-normal`] = true; } else { imageNode = image; } return
{imageNode}
{des &&

{des}

}, {this.$slots.default ?
{this.$slots.default()}
: null}
; } }) as any; Empty.PRESENTED_IMAGE_DEFAULT = DefaultEmptyImg; Empty.PRESENTED_IMAGE_SIMPLE = SimpleEmptyImg; /* istanbul ignore next */ Empty.install = function(app) { app.use(Base); app.component(Empty.name, Empty); }; export default Empty;