Refactor #3965 - For Card

pull/3997/head
Bahadır Sofuoğlu 2023-05-23 01:03:28 +03:00
parent 6ac09a0794
commit 2bb67db7b5
3 changed files with 35 additions and 9 deletions

View File

@ -0,0 +1,21 @@
<script>
import BaseComponent from 'primevue/basecomponent';
const classes = {
root: 'p-card p-component',
header: 'p-card-header',
body: 'p-card-body',
title: 'p-card-title',
subtitle: 'p-card-subtitle',
content: 'p-card-content',
footer: 'p-card-footer'
};
export default {
name: 'BaseCard',
extends: BaseComponent,
css: {
classes
}
};
</script>

View File

@ -63,6 +63,11 @@ export interface CardProps {
* @type {CardPassThroughOptions} * @type {CardPassThroughOptions}
*/ */
pt?: CardPassThroughOptions; pt?: CardPassThroughOptions;
/**
* When enabled, it removes component related styles in the core.
* @defaultValue false
*/
unstyled?: boolean;
} }
/** /**

View File

@ -1,19 +1,19 @@
<template> <template>
<div class="p-card p-component" v-bind="ptm('root')"> <div :class="cx('root')" v-bind="ptm('root')">
<div v-if="$slots.header" class="p-card-header" v-bind="ptm('header')"> <div v-if="$slots.header" :class="cx('header')" v-bind="ptm('header')">
<slot name="header"></slot> <slot name="header"></slot>
</div> </div>
<div class="p-card-body" v-bind="ptm('body')"> <div :class="cx('body')" v-bind="ptm('body')">
<div v-if="$slots.title" class="p-card-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="p-card-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 class="p-card-content" v-bind="ptm('content')"> <div :class="cx('content')" v-bind="ptm('content')">
<slot name="content"></slot> <slot name="content"></slot>
</div> </div>
<div v-if="$slots.footer" class="p-card-footer" v-bind="ptm('footer')"> <div v-if="$slots.footer" :class="cx('footer')" v-bind="ptm('footer')">
<slot name="footer"></slot> <slot name="footer"></slot>
</div> </div>
</div> </div>
@ -21,10 +21,10 @@
</template> </template>
<script> <script>
import BaseComponent from 'primevue/basecomponent'; import BaseCard from './BaseCard.vue';
export default { export default {
name: 'Card', name: 'Card',
extends: BaseComponent extends: BaseCard
}; };
</script> </script>