fix(design): card没有slots时隐藏对应slot

This commit is contained in:
roymondchen 2025-03-27 11:12:27 +08:00
parent 2a714ae9cc
commit 4ddc55aa6d
2 changed files with 3 additions and 3 deletions

View File

@ -1,10 +1,10 @@
<template> <template>
<component class="tmagic-design-card" :is="uiComponent" v-bind="uiProps"> <component class="tmagic-design-card" :is="uiComponent" v-bind="uiProps">
<template #header> <template #header v-if="$slots.header">
<slot name="header" class="header"></slot> <slot name="header" class="header"></slot>
</template> </template>
<template #default> <template #default v-if="$slots.default">
<slot name="default"></slot> <slot name="default"></slot>
</template> </template>
</component> </component>

View File

@ -6,7 +6,7 @@
@update:modelValue="updateModelValue" @update:modelValue="updateModelValue"
@change="changeHandler" @change="changeHandler"
> >
<template #default> <template #default v-if="$slots.default">
<slot></slot> <slot></slot>
</template> </template>
</component> </component>