ant-design-vue/components/card/Meta.jsx

40 lines
1.2 KiB
Vue
Raw Normal View History

2018-03-19 10:16:27 +08:00
2018-01-20 14:33:42 +08:00
import PropTypes from '../_util/vue-types'
import { getComponentFromProp } from '../_util/props-util'
export default {
2018-04-08 21:17:20 +08:00
name: 'ACardMeta',
2018-01-20 14:33:42 +08:00
props: {
prefixCls: PropTypes.string.def('ant-card'),
title: PropTypes.any,
description: PropTypes.any,
2018-01-20 14:33:42 +08:00
},
render () {
const { prefixCls = 'ant-card' } = this.$props
2018-01-20 14:33:42 +08:00
const classString = {
[`${prefixCls}-meta`]: true,
}
const avatar = getComponentFromProp(this, 'avatar')
const title = getComponentFromProp(this, 'title')
const description = getComponentFromProp(this, 'description')
2018-01-20 14:33:42 +08:00
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 {...{ on: this.$listeners }} class={classString}>
2018-01-20 14:33:42 +08:00
{avatarDom}
{MetaDetail}
</div>
)
},
}
2018-03-19 10:16:27 +08:00