You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/card/Meta.jsx

41 lines
1.2 KiB

import PropTypes from '../_util/vue-types';
import { getComponentFromProp } from '../_util/props-util';
7 years ago
export default {
name: 'ACardMeta',
7 years ago
props: {
prefixCls: PropTypes.string.def('ant-card'),
title: PropTypes.any,
description: PropTypes.any,
7 years ago
},
render() {
const { prefixCls = 'ant-card' } = this.$props;
7 years ago
const classString = {
[`${prefixCls}-meta`]: true,
};
7 years ago
const avatar = getComponentFromProp(this, 'avatar');
const title = getComponentFromProp(this, 'title');
const description = getComponentFromProp(this, 'description');
const avatarDom = avatar ? <div class={`${prefixCls}-meta-avatar`}>{avatar}</div> : null;
const titleDom = title ? <div class={`${prefixCls}-meta-title`}>{title}</div> : null;
const descriptionDom = description ? (
<div class={`${prefixCls}-meta-description`}>{description}</div>
) : null;
const MetaDetail =
titleDom || descriptionDom ? (
<div class={`${prefixCls}-meta-detail`}>
{titleDom}
{descriptionDom}
</div>
) : null;
7 years ago
return (
<div {...{ on: this.$listeners }} class={classString}>
7 years ago
{avatarDom}
{MetaDetail}
</div>
);
7 years ago
},
};