JAVASCRIPT
VUE
REACT
NODE
ES6
TYPESCRIPT

Elemntui的上传方法自定义参数

2023. 07. 13    

ElemntUI的上传方法自定义参数

ElemntUI的上传方法自定义参数

<el-upload
    class="upload-demo"
    :action="upLoadApi"
    :on-remove="handleRemove"
    :before-remove="beforeRemove"
    multiple
    :show-file-list="false"
    :on-success="(response, file, fileList) => handleSuccess(response, file, fileList,index)"
    >
    <div class="btn-wrap">
        <button class="button-grey button-dashboard">Upload</button>
    </div>
</el-upload>


handleSuccess(res, file, fileList,index){
    console.log(fileList,index);
    let list = JSON.parse(JSON.stringify(fileList));
    list.map((item) => {
        let obj = {};
        obj.name = item.name;
        obj.path = item.response.data.path || item.response.data.videoPath;
        this.warehouseData[index].fileList.push(obj);
    });
},