Files
short-drama-agent-front/src/components/ui/WorkspaceSectionHeading.vue
T

48 lines
1.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
/** 工作区模块标题、说明及操作位置的统一展示参数。 */
interface Props {
/** 模块标题。 */
title: string
/** 操作放右侧同行或说明下方左侧;默认保持已有页面布局。 */
actionsPlacement?: 'right' | 'below'
/** 模块说明,可通过 description 插槽补充状态与提示。 */
description?: string
}
/** 标题与说明由业务模块提供,操作通过插槽复用统一对齐方式。 */
defineProps<Props>()
</script>
<template>
<!-- 以下是统一的模块标题与可选同行操作模块 -->
<header class="workspace-section-heading">
<div class="workspace-section-heading-row">
<h3 class="text-sm font-semibold">{{ title }}</h3>
<div v-if="$slots.actions && actionsPlacement !== 'below'" class="workspace-section-heading-actions">
<slot name="actions" />
</div>
</div>
<!-- 以下是标题下方的说明与状态模块 -->
<div v-if="description || $slots.description" class="workspace-section-description">
<slot name="description">{{ description }}</slot>
</div>
<!-- 以下是正文左侧的模块操作,与标题及说明共用边界 -->
<div v-if="$slots.actions && actionsPlacement === 'below'" class="workspace-section-heading-actions mt-4">
<slot name="actions" />
</div>
</header>
</template>
<style>
@reference "../../styles/styles.css";
.workspace-section-heading-row {
@apply flex min-w-0 flex-wrap items-center justify-between gap-3;
}
.workspace-section-heading-actions {
@apply flex shrink-0 flex-wrap items-center gap-3;
}
.workspace-section-description {
@apply mt-2 text-xs leading-6 text-muted;
}
</style>