import { inject } from 'vue'; import PropTypes from '../_util/vue-types'; import { getComponent } from '../_util/props-util'; import { ConfigConsumerProps } from '../config-provider'; export default { name: 'ACardMeta', props: { prefixCls: PropTypes.string, title: PropTypes.any, description: PropTypes.any, avatar: PropTypes.any, }, setup() { return { configProvider: inject('configProvider', ConfigConsumerProps), }; }, render() { const { prefixCls: customizePrefixCls } = this.$props; const getPrefixCls = this.configProvider.getPrefixCls; const prefixCls = getPrefixCls('card', customizePrefixCls); const classString = { [`${prefixCls}-meta`]: true, }; const avatar = getComponent(this, 'avatar'); const title = getComponent(this, 'title'); const description = getComponent(this, 'description'); const avatarDom = avatar ?
{avatar}
: null; const titleDom = title ?
{title}
: null; const descriptionDom = description ? (
{description}
) : null; const MetaDetail = titleDom || descriptionDom ? (
{titleDom} {descriptionDom}
) : null; return (
{avatarDom} {MetaDetail}
); }, };