/*
 * @Author: Zh_Strong
 * @Date: 2022-10-15 18:20:19
 * @LastEditTime: 2022-10-17 13:45:19
 * @LastEditors: Zh_Strong
 * @Description: Zh_Strong
 * @FilePath: \layui-encapsulation\layui\lib\upload.js
 */
/**Layui上传类说明
 * @parameter 传递的参数{}，参数如下：
 ** elem: "", // 绑定元素，(必填项) 指向容器选择器 类型（ string / object）
 */
class lay_upload {
    constructor(parameter = {}) {
        this.parameter = parameter;
        let that = this;
        layui.use(['upload'], function () {
            var upload = layui.upload;
            that.uploadItem = upload.render(that.parameter);
        });
        return that.uploadItem;
    };
    // 重载上传实例
    reload(parameter) {
        let that = this;
        layui.use(['upload'], function () {
            that.uploadItem.reload(parameter);
        });
    }
    // 重新上传
    upload() {
        let that = this;
        layui.use(['upload'], function () {
            that.uploadItem.upload();
        });
    }
    /**
     * 上传类的参数提示
     */
    static config = {
        elem: "elem",
        url: "url",
        data: "data",
        headers: "headers",
        accept: "accept",
        acceptMime: "acceptMime",
        exts: "exts",
        auto: "auto",
        bindAction: "bindAction",
        field: "field",
        size: "size",
        multiple: "multiple",
        number: "number",
        drag: "drag",
        choose: "choose",
        before: "before",
        done: "done",
        error: "error"
    };
};

export default lay_upload;