simple-card.vue 1.3 KB
<template>
    <section
        :class="
            props.customClass.length > 0 ? `${props.customClass} card` : 'card'
        "
    >
        <div class="header">
            <div class="title" v-text="props.title" />
            <div class="extend">
                <slot name="extend" />
            </div>
        </div>
        <div class="body">
            <slot name="component" />
        </div>
    </section>
</template>
<script setup>
const props = defineProps({
    title: {
        type: String,
        default: 'Title'
    },
    customClass: {
        type: String,
        default: ''
    }
});
</script>
<style lang="less" scoped>
.card {
    width: 222px;
    padding: 12px 14px 12px 14px;
    border-radius: 10px;
    box-shadow: rgba(145, 153, 163, 0.16) 0px 1px 1px;
    border: 1px solid rgb(205, 209, 213);
    background-color: rgb(255, 255, 255);
    color: black;
    white-space: pre-wrap;
    .header {
        display: flex;
        flex-direction: row;
        -webkit-box-pack: justify;
        justify-content: space-between;
        margin-bottom: 16px;
        height: 18px;
        .title {
            margin: 0px;
            font-size: 16px;
            line-height: 24px;
            font-weight: 700;
        }
        .extend {
            padding-left: 8px;
        }
    }
}
</style>