import type { ExtractPropTypes } from 'vue'; import { defineComponent } from 'vue'; import PropTypes from '../_util/vue-types'; import { getPropsSlot } from '../_util/props-util'; import useConfigInject from '../_util/hooks/useConfigInject'; export const cardMetaProps = () => ({ prefixCls: String, title: PropTypes.any, description: PropTypes.any, avatar: PropTypes.any, }); export type CardGridProps = Partial>>; export default defineComponent({ name: 'ACardMeta', props: cardMetaProps(), slots: ['title', 'description', 'avatar'], setup(props, { slots }) { const { prefixCls } = useConfigInject('card', props); return () => { const classString = { [`${prefixCls.value}-meta`]: true, }; const avatar = getPropsSlot(slots, props, 'avatar'); const title = getPropsSlot(slots, props, 'title'); const description = getPropsSlot(slots, props, '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}
); }; }, });