<template>
    <div class="wrantip-page el-row">
        <div>
            <el-checkbox v-model="selfCheck" @change="handleChange" :isIndeterminate="isIndeterminate"></el-checkbox>
            <span class="theme_font_color padding5">{{label}}</span>
            <slot></slot>
        </div>
        <div class="right-count-div" v-if="count > 0">
<!--            <span v-if="count">选择 全部 数据</span>-->
            <span v-if="count > 0">选择 {{count}} 条数据</span>
<!--            <span v-else></span>-->
        </div>
    </div>
</template>

<script>
export default {
    name: "veAllCheck",
    data() {
        return {
            selfCheck: this.checked
        };
    },
    props: {
        value: {
            type: Boolean,
            default: false
        },
        label: {
            type: String,
            default: "全选 （支持选择跨分页数据）"
        },
        count: {
            type: Number,
            default: 0
        },
        /* 全选按钮是否模糊状态 */
        isIndeterminate: {
            type: Boolean,
            default: false
        },

    },
    model: {
        prop: 'value',
        event: 'change'
    },
    methods: {
        handleChange(val) {
            this.$emit("change", val);
        }
    },
    watch:{
        value:{
            immediate:true,
            handler(nVal,oVal){
                this.selfCheck = nVal
            }
        }
    }
};
</script>

<style scoped  lang="less">
.wrantip-page {
    font-size: 13px;
    margin-bottom: 10px;
    padding-left: 14px;
    margin-top: 15px;
    display: flex;
    .padding5{
        padding-left: 5px;
    }
    .right-count-div {
        position: absolute;
        right: 14px;
    }
    /*/deep/ .el-checkbox__inner {*/
        /*border-color: #FF4436;*/
    /*}*/
}
</style>
