yangyin
2024-12-13 c6cf46f3e11e60f692e0b8d12188458ad1b6120e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<template>
    <div class="flex flex-col" :class="[`gap-${gapLen}`]">
        <div class="flex-items-center justify-between">
            <div class="text-base " :class="[level==='1' ? 'font-bold':'text-secondary']">{{ title }}</div>
            <div class="flex-items-center gap-3" v-if="$slots.right">
                <slot name="right"></slot>
            </div>
        </div>
 
        <slot></slot>
    </div>
</template>
 
<script setup lang="ts">
import { computed } from 'vue';
 
type HeaderLevel = '1' | '2';
 
const props = defineProps({
    title: {
        type: String,
    },
    /** @description 标题等级 */
    level: {
        type: String as () => HeaderLevel,
        default: '1',
    },
});
 
const gapLen = computed(() => {
    if (props.level === '1') {
        return '2';
    } else {
        return '2';
    }
});
</script>
<style scoped lang="scss"></style>