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

37 lines
1.0 KiB

import PropTypes from '../_util/vue-types'
import { getComponentFromProp } from '../_util/props-util'
export default {
name: 'Meta',
props: {
prefixCls: PropTypes.string.def('ant-card'),
title: PropTypes.string,
description: PropTypes.string,
},
render () {
const { prefixCls = 'ant-card', title, description, ...others } = this.$props
const classString = {
[`${prefixCls}-meta`]: true,
}
const avatar = getComponentFromProp(this, 'avatar')
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
return (
<div {...others} class={classString}>
{avatarDom}
{MetaDetail}
</div>
)
},
}