refactor: 优化 ContentWrap 提升拓展能力

pull/87/head
puhui999 2025-04-27 18:10:45 +08:00
parent 0e92472904
commit c200490585
1 changed files with 22 additions and 2 deletions

View File

@ -5,25 +5,45 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
import { Card } from 'ant-design-vue'; import { ShieldQuestion } from '@vben/icons';
import { Card, Tooltip } from 'ant-design-vue';
defineOptions({ name: 'ContentWrap' }); defineOptions({ name: 'ContentWrap' });
withDefaults( withDefaults(
defineProps<{ defineProps<{
bodyStyle?: CSSProperties; bodyStyle?: CSSProperties;
message?: string;
title?: string; title?: string;
}>(), }>(),
{ {
bodyStyle: () => ({ padding: '10px' }), bodyStyle: () => ({ padding: '10px' }),
title: '', title: '',
message: '',
}, },
); );
// TODO @puhui999 vue3
</script> </script>
<template> <template>
<Card :body-style="bodyStyle" :title="title" class="mb-4"> <Card :body-style="bodyStyle" :title="title" class="mb-4">
<template v-if="title" #title>
<div class="flex items-center">
<span class="text-4 font-[700]">{{ title }}</span>
<Tooltip placement="right">
<template #title>
<div class="max-w-[200px]">{{ message }}</div>
</template>
<ShieldQuestion :size="14" class="ml-5px" />
</Tooltip>
<div class="pl-20px flex flex-grow">
<slot name="header"></slot>
</div>
</div>
</template>
<template #extra>
<slot name="extra"></slot>
</template>
<slot></slot> <slot></slot>
</Card> </Card>
</template> </template>