Fixed #5020 - Add caption option to passthrough options on Card

pull/5024/head
mertsincan 2024-01-03 11:06:19 +00:00
parent 4c57243a42
commit 8e1354d099
3 changed files with 12 additions and 5 deletions

View File

@ -31,6 +31,10 @@ export interface CardPassThroughOptions {
* Used to pass attributes to the body's DOM element. * Used to pass attributes to the body's DOM element.
*/ */
body?: CardPassThroughOptionType; body?: CardPassThroughOptionType;
/**
* Used to pass attributes to the caption's DOM element.
*/
caption?: CardPassThroughOptionType;
/** /**
* Used to pass attributes to the title's DOM element. * Used to pass attributes to the title's DOM element.
*/ */

View File

@ -4,12 +4,14 @@
<slot name="header"></slot> <slot name="header"></slot>
</div> </div>
<div :class="cx('body')" v-bind="ptm('body')"> <div :class="cx('body')" v-bind="ptm('body')">
<div v-if="$slots.title || $slots.subtitle" :class="cx('caption')" v-bind="ptm('caption')">
<div v-if="$slots.title" :class="cx('title')" v-bind="ptm('title')"> <div v-if="$slots.title" :class="cx('title')" v-bind="ptm('title')">
<slot name="title"></slot> <slot name="title"></slot>
</div> </div>
<div v-if="$slots.subtitle" :class="cx('subtitle')" v-bind="ptm('subtitle')"> <div v-if="$slots.subtitle" :class="cx('subtitle')" v-bind="ptm('subtitle')">
<slot name="subtitle"></slot> <slot name="subtitle"></slot>
</div> </div>
</div>
<div :class="cx('content')" v-bind="ptm('content')"> <div :class="cx('content')" v-bind="ptm('content')">
<slot name="content"></slot> <slot name="content"></slot>
</div> </div>

View File

@ -4,6 +4,7 @@ const classes = {
root: 'p-card p-component', root: 'p-card p-component',
header: 'p-card-header', header: 'p-card-header',
body: 'p-card-body', body: 'p-card-body',
caption: 'p-card-caption',
title: 'p-card-title', title: 'p-card-title',
subtitle: 'p-card-subtitle', subtitle: 'p-card-subtitle',
content: 'p-card-content', content: 'p-card-content',