<template>
    <div class="el-checkbox" :class="{ checked: value.includes(label) }">
        <i class="icon"></i><slot></slot>
    </div>
</template>

<script>
export default {
    props: {
        label: [String, Number],
        value: { type: Array, default: () => [] }
    }
}
</script>

<style lang="less" scoped>
.el-checkbox {
    font-size: 14px;
    padding: 3px 0;
    &.checked {
        color: #409EFF;
        .icon {
            background: #409EFF;
            border-color: #409EFF;
        }
    }
    .icon {
        width: 14px;
        height: 14px;
        border-radius: 2px;
        margin-right: 10px;
        background-color: #FFF;
        border: 1px solid #DCDFE6;
        vertical-align: top;
        line-height: 1;
        position: relative;
        display: inline-flex;
        justify-content: center;
        align-items: center;
        &::after {
            content: "";
            width: 3px;
            height: 7px;
            border: 1px solid #FFF;
            border-left: 0;
            border-top: 0;
            transform: translateY(-1px) rotate(45deg);
        }
    }
}
</style>
