<template>
    <div
        :class="{ 'card': true, [className]: className }"
        :style="{ minWidth: width + 'px', height: height + 'px' }"
    >
        <div class="wrap">
            <div class="header">
                <div class="title">{{ title }}</div>
                <el-link v-if="isMore" type="primary" @click="clickMore">查看更多</el-link>
            </div>
            <slot></slot>
        </div>
    </div>
</template>

<script>
export default {
    props: {
        title: {
            type: String
        },
        width: {
            type: String
        },
        height: {
            type: String
        },
        isMore: {
            type: Boolean,
            default: false
        },
        className: {
            type: String
        },
    },
    methods: {
        clickMore() {
            this.$emit('more')
        }
    },
}
</script>

<style lang="scss" scoped>
.card {
    background: white;
    border-radius: 10px;
}

.wrap {
    padding: 12px 12px 0 12px;
}
.header {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.title {
    font-size: 16px;
    color: #1d2129;
}
.more {
    font-size: 12px;
    color: #1d68ff;
}
</style>
