<template>
    <div>
        <el-upload
            :id="id"
            action="default"
            :on-success="handleSuccess"
            :on-remove="handleRemove"
            :on-error="handleError"
            :before-upload="beforeUpload"
            :file-list="fileList"
            :http-request="httpRequest"
            :limit="option_limit"
            :on-exceed="handleExceed"
            ref="veUpload"
            :accept="option_accept"
            v-bind="$attrs"
            v-on="$listeners"
            class="upload-content"
            :class="hasUploadFile?'upload-success':''"
        >
            <slot name="trigger" slot="trigger"></slot>
            <el-button size="small" type="primary"
            >点击上传
            </el-button>
        </el-upload>
        <slot name="tip"></slot>
    </div>
</template>

<script>
import mixin from "./mixin";

export default {
    name: "single-button",
    mixins: [mixin],
    data() {
        return {}
    },
    created() {
        this.setOptions({
            multiple: false,
        })
    },
    methods: {}
}
</script>

<style scoped lang="less">
.upload-content {
    /deep/ .el-upload__tip {
        align-self: flex-end;
        margin-bottom: 0;
        margin-left: 5px;
    }
}

.upload-success {
    /deep/ .el-upload--text {
        display: none;
    }
}
</style>
